Couchbase Lite for Dart and Flutter
Important
Upgrading from v3? See the migration guide.
Features
- SQL++ Queries — A SQL superset designed for JSON documents, with JOINs, aggregations, and parameterized queries.
- Full-Text Search — Built-in full-text indexing and search.
- Vector Search — On-device similarity search using vector embeddings. Enterprise Edition
- Live Queries — Reactive, auto-updating query results.
- Data Sync — Bi-directional sync with Couchbase Server via Sync Gateway.
- Peer-to-Peer Sync — Sync directly between devices without a server. Enterprise Edition
- Encryption — AES-256 database encryption at rest. Enterprise Edition
- Multi-Platform — Android, iOS, macOS, Windows, Linux.
Getting Started
Add the package:
dart pub add cbl
Open a database and run a query:
import 'package:cbl/cbl.dart';
Future<void> main() async {
await CouchbaseLite.init();
final database = await Database.openAsync('my-database');
final collection = await database.createCollection('tasks');
await collection.saveDocument(
MutableDocument({'title': 'Learn Couchbase Lite', 'done': false}),
);
final query = await database.createQuery(
"SELECT * FROM tasks WHERE done = false",
);
final results = await (await query.execute()).allResults();
print('Pending tasks: ${results.length}');
await database.close();
}
Read the full documentation at cbl-dart.dev
Enterprise Edition
By default, the Community Edition is used. To use the Enterprise Edition,
configure it in your pubspec.yaml:
hooks:
user_defines:
cbl:
edition: enterprise
Related Packages
- cbl_sentry — Sentry integration for breadcrumbs and performance tracing.
- cbl_generator — Code generation for typed document model classes.
Contributing
Pull requests are welcome. For major changes, please open an issue first. Read CONTRIBUTING to get started.
Disclaimer
This is not an official Couchbase product.