EasyDb class

The main entry point for flutter_easy_db.

Provides a secure, encrypted local database with a simple API inspired by Isar's ease-of-use and Drift's type-safety.

Example:

final db = await EasyDb.open(
  EasyDbConfig(
    dbName: 'my_app',
    encryptionKey: 'my-32-character-secret-key!!!!!', // exactly 32 chars
  ),
);

final users = db.collection('users');
await users.put({'name': 'Alice', 'email': 'alice@example.com'});

final results = await users.query()
  .where('name', isEqualTo: 'Alice')
  .find();

await db.close();

Properties

collections → Future<List<String>>
Returns all collection names that have data.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isEncrypted → bool
Whether encryption is enabled.
no setter
name → String
The database name.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearAll() → Future<void>
Clears all data from the database.
close() → Future<void>
Closes the database connection.
collection(String name) → EasyCollection
Gets or creates a collection (like a table/bucket).
dropCollection(String name) → Future<void>
Deletes an entire collection and all its documents.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

deleteDatabase(String dbName, {String? dbPath}) → Future<void>
Deletes the database file entirely.
open(EasyDbConfig config) → Future<EasyDb>
Opens or creates a database with the given configuration.