cbl_flutter 1.0.0-beta.3 cbl_flutter: ^1.0.0-beta.3 copied to clipboard
Couchbase Lite for Flutter. Couchbase Lite is A NoSQL database with change notification, full text search and replication.
cbl_flutter #
This package enables using Couchbase Lite
(cbl
) in Flutter apps.
Supported Platforms #
Platform | Minimum version |
---|---|
iOS | 11 |
macOS | 10.15 |
Android | 22 |
Getting started #
You need to add cbl
and cbl_flutter
as dependencies. cbl_flutter
currently supports iOS, macOS and Android.
dependencies:
cbl: ...
cbl_flutter: ...
Make sure you have set the required minimum target version in the build systems of the platforms you support.
Couchbase Lite needs to be initialized, before it can be used:
import 'package:cbl_flutter/cbl_flutter.dart';
Future<void> initCouchbaseLite() async {
await CouchbaseLiteFlutter.init();
}
Now you can use Database.open
to open a database:
import 'package:cbl/cbl.dart';
Future<void> useCouchbaseLite() async {
final db = await Database.openAsync('chat-messages');
final doc = MutableDocument({
'type': 'message',
'body': 'Heyo',
'from': 'Alice',
});
await db.saveDocument(doc);
await db.close();
}