SimpleReaxDB class
Simple, easy-to-use API for ReaxDB that covers 80% of use cases.
This is the recommended way to start using ReaxDB. For advanced features like transactions, secondary indexes, or custom configurations, you can access the full API through the advanced property.
Example:
// Quick start - just one line!
final db = await ReaxDB.simple('myapp');
// Store data
await db.put('user:1', {'name': 'John', 'age': 30});
// Retrieve data
final user = await db.get('user:1');
// Query data
final users = await db.query('user:*');
// Delete data
await db.delete('user:1');
// Need advanced features? Access the full API
await db.advanced.transaction((txn) async {
// Complex transactional operations
});
Properties
Methods
-
clear(
) → Future< void> - Clear all data in the database.
-
close(
) → Future< void> - Close the database.
-
count(
[String pattern = '*']) → Future< int> - Count keys matching a pattern.
-
delete(
String key) → Future< void> - Delete a value by key.
-
deleteAll(
List< String> keys) → Future<void> - Delete multiple keys at once.
-
exists(
String key) → Future< bool> - Check if a key exists.
-
get(
String key) → Future - Retrieve a value by key.
-
getAll(
String pattern) → Future< Map< String, dynamic> > - Get all values matching a key pattern.
-
info(
) → Future< DatabaseInfo> - Get database statistics.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
String key, dynamic value) → Future< void> - Store a value with a key.
-
putAll(
Map< String, dynamic> entries) → Future<void> - Store multiple values at once (batch operation).
-
query(
String pattern) → Future< List< String> > - Query keys matching a pattern.
-
toString(
) → String -
A string representation of this object.
inherited
-
watch(
[String? pattern]) → Stream< DatabaseChangeEvent> - Listen to real-time changes in the database.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited