dart_appwrite_database_easy 0.0.1
dart_appwrite_database_easy: ^0.0.1 copied to clipboard
Just an easy wrapper for the AppWrite database
Dart AppWrite Database Easy #
This is a package that provides a simplified way to use the official AppWrite SDK in Dart to access the database.
Installation #
Add this to your pubspec.yaml:
dependencies:
dart_appwrite_database_easy: ^0.0.1
Usage #
Here's an example of how you can use this package:
import 'package:dart_appwrite_database_easy/dart_appwrite_database_easy.dart';
// Create one class that extends the CollectionManager and override some methods
class Subscriptions extends CollectionManager {
Subscriptions(super.databases);
@override
String get collectionId => 'subscriptions';
@override
List<CollectionManager> get dependencies => [Plans(databases)];
@override
Future<bool> create() async {
// To resolve dependencies
await super.create();
// Create collection
await createCollection();
// Attributes
await addAttribute(type: AttributeType.float, key: 'price', xrequired: true);
await addAttribute(type: AttrType.string, key: 'googleId', xrequired: true);
// Relations
await addRelationship(
key: 'plan',
relatedCollectionId: 'plans',
type: RelationshipType.manyToOne,
);
// Indexes
await addIndex(key: 'googleId', type: IndexType.key, attributes: ['googleId']);
}
}
Features / To Do #
- ✅ Facilitate access to the AppWrite database
- ❌ Add more usage examples
- ❌ Implement additional functionalities
Contribution #
Contributions are welcome! If you find bugs or want to add new features, feel free to open an issue or send a pull request.