0 purchases
cbl
Couchbase Lite is an embedded, NoSQL database:
Multi-Platform - Android, iOS, macOS, Windows, Linux
Standalone Dart and Flutter - No manual setup required, just add the
package.
Fast and Compact - Uses efficient persisted data structures.
It is fully featured:
JSON Style Documents - No explicit schema and supports deep nesting.
Expressive Queries - SQL++ (SQL for JSON), QueryBuilder, Full-Text
Search
Observable - Get notified of changes in database, queries and data sync.
Data Sync - Pull and push data from/to server with full control over
synced data.
❤️ If you find this package useful, please ⭐ us on pub.dev and
GitHub. 🙏
🐛 & ✨ Did you find a bug or have a feature request? Please open a GitHub
issue.
👋 Do you you have a question or feedback? Let us know in a GitHub
discussion.
Proudly sponsored by #
This package provides the Couchbase Lite API independent of whether you want to
use Couchbase Lite in a standalone Dart app or in a Flutter app.
To get started, go to the documentation.
Below is a sneak peak of what it's like to use Couchbase Lite.
import 'package:cbl/cbl.dart';
Future<void> run() async {
// Open the database (creating it if it doesn’t exist).
final database = await Database.openAsync('database');
// Create a collection, or return it if it already exists.
final collection = await database.createCollection('components');
// Create a new document.
final mutableDocument = MutableDocument({'type': 'SDK', 'majorVersion': 2});
await collection.saveDocument(mutableDocument);
print(
'Created document with id ${mutableDocument.id} and '
'type ${mutableDocument.string('type')}.',
);
// Update the document.
mutableDocument.setString('Dart', key: 'language');
await collection.saveDocument(mutableDocument);
print(
'Updated document with id ${mutableDocument.id}, '
'adding language ${mutableDocument.string("language")!}.',
);
// Read the document.
final document = (await collection.document(mutableDocument.id))!;
print(
'Read document with id ${document.id}, '
'type ${document.string('type')} and '
'language ${document.string('language')}.',
);
// Create a query to fetch documents of type SDK.
print('Querying Documents of type=SDK.');
final query = await database.createQuery('''
SELECT * FROM components
WHERE type = 'SDK'
''');
// Run the query.
final result = await query.execute();
final results = await result.allResults();
print('Number of results: ${results.length}');
// Close the database.
await database.close();
}
copied to clipboard
🤝 Contributing #
Pull requests are welcome. For major changes, please open an issue first to
discuss what you would like to change.
Please make sure to update tests as appropriate.
Read CONTRIBUTING to get started developing.
Prior work #
Thanks to the authors of earlier Couchbase Lite packages. Those packages where
valuable references for making decisions about how to approach this project.
Luca Christille -
fluttercouch
Bryan Welter -
couchbase_lite
Rudolf Martincsek -
couchbase_lite_dart
⚖️ Disclaimer #
⚠️ This is not an official Couchbase product.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.