Package selection guidance compiled from public package information, community data, and project usage.
ObjectDB is a persistent, embedded document-oriented NoSQL database designed for Dart and Flutter applications. It enables local data storage with JSON-like documents, supporting full CRUD operations without requiring a separate server. Built for simplicity and performance, it works across all major platforms including mobile, web, and desktop. ObjectDB automatically handles data persistence and schema evolution, making it ideal for offline-first apps that need reliable local storage.
Use cases
Offline-first mobile apps
Local data storage in Flutter apps
Cross-platform data persistence
Prototyping with local databases
Simple document-based data modeling
Key features
Embedded and zero-configuration
Supports all Flutter platforms
JSON-like document storage
Automatic persistence
Schema-less design
Suitable for
Developers seeking lightweight local storage
Apps needing offline functionality
Projects avoiding external database dependencies
Rapid prototyping
Small to medium-sized data sets
Considerations
Not suitable for large-scale or high-concurrency scenarios
Limited querying capabilities compared to full SQL databases
No built-in synchronization with remote servers
Best suited for single-device use cases
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
ObjectDB
Persistent embedded document-oriented NoSQL database for Dart and Flutter. 100% Dart.
If you notice any bugs you can create an issue on GitHub. You're also welcome to contribute using pull requests. Please open an issue before spending time on any pull request.
Future<void> db.close() closes database (should be awaited to ensure all queries have been executed)
find
Future<List<Map>> db.find(Map query) List with all matched documents
Future<Map> db.first(Map query) first matched document
Future<Map> db.last(Map query) last matched document
insert
Future<ObjectId> db.insert(Map document) insert single document
Future<List<ObjectId>> db.insertMany(List<Map> documents) insert many documents
update
Future<int> db.update(Map query, Map changes, [bool replace = false]) update documents that mach query with changes (optionally replace whole document)
remove
Future<int> db.remove(Map query) remove documents that match query
Query
// Match fields in subdocuments
{Op.gte: {
'birthday.year': 18
}}
// or-operator
{Op.or: {
'active': true,
Op.inList: {'group': ['admin', 'moderator']}
}}
// not equal to
{Op.not: {'active': false}}
NOTE Querying arrays is not supportet yet.
Operators
Logical
and (default operator on first level)
or
not
Comparison
lt, lte: less than, less than or equal
gt, gte: greater than, greater than or equal
inList, notInList: value in list, value not in list
Modify
set: set value
max, min: set max or min int value
increment, multiply: increment/multiply by
unset: unset key/value
rename: rename key
todo: push / pull
{Op.set: {'path.to.key': 'value'}} // set entry['path']['to']['key'] = 'value' (path will be created if not exists)
{Op.max: {'path.to.key': 200}} // set value 200 if value is greater than 200
{Op.min: {'path.to.key': 200}} // set value 200 if value is smaller than 200
{Op.increment: {'path.to.key': -5}} // increment value by negative 5
{Op.multiply: {'path.to.key': 2}} // multiply value by 2
{Op.unset: {'path.to.key': true}} // unset key/value at entry['path']['to']['key'] if exists
{Op.rename: {'path.to.key': 'new_key'}} // new value will be at entry['path']['to']['new_key']
db.update({
'age': RegExp('[18-20]'),
Op.gt: {'duration': 500},
}, {
Op.max: {'stats.score': 100},
Op.increment: {'stats.level': -5},
});