Last updated:
0 purchases
nesteggdb
NestEggDB #
NestEggDB is a lightweight, file-based NoSQL database for Flutter, using Nest (database) and Egg (document/data entry). It supports transactions, queries, and ordered data storage.
Features #
Manage data with Nests (collections) and Eggs (entries).
Perform atomic transactions.
Filter and sort data with queries.
Preserve data order.
Handle hierarchical data with Sub-Eggs.
Installation #
Add to pubspec.yaml:
dependencies:
egg_nest_db: ^0.0.3
copied to clipboard
Run:
flutter pub get
copied to clipboard
Usage #
import 'package:egg_nest_db/nest.dart';
// Initialize a Nest
final nest = Nest(path: '/path/to/database');
final collection = nest.eggCollection('myCollection');
// Add an Egg
collection.addEgg({'id': '1', 'name': 'First Egg', 'content': 'This is the first egg.'});
// Retrieve an Egg
final egg = collection.getEgg('1');
print('Egg content: ${egg?.data}');
// Update an Egg
collection.updateEgg('1', {'content': 'Updated content for the first egg.'});
// Delete an Egg
collection.deleteEgg('1');
// Perform a Transaction
nest.runTransaction((transaction) {
transaction.add(collection, {'id': '2', 'name': 'Second Egg', 'content': 'This is the second egg.'});
});
// Query Data
final query = Query(collection).where('name', 'isEqualTo', 'First Egg').orderBy('id');
final results = query.get();
for (var result in results) {
print(result);
}
// Get All Data with Sub-Eggs
print(collection.getAllData());
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.