cbl_flutter 1.0.0-beta.8 cbl_flutter: ^1.0.0-beta.8 copied to clipboard
Flutter Plugin for Couchbase Lite, an embedded, NoSQL JSON Document Style database, supporting Blobs, Encryption, N1QL Queries, Live Queries, Full-Text Search and Data Sync.
This is the Flutter plugin for Couchbase Lite.
The Couchbase Lite API is in the cbl
package. This package is enabling
the use of cbl
in Flutter apps.
This package is in beta. Use it with caution and report any issues you see.
🎯 Platform Support #
Platform | Version | Note |
---|---|---|
iOS | >= 10.0 | |
macOS | >= 10.14 | |
Android | >= 22 | |
Linux | == Ubuntu 20.04-x86_64 | 🐛 Currently broken because of a bug in Flutter. Most notably, operations trying to return an error crash the app. |
Windows | >= 10 | 🚧 Not yet implemented |
🔌 Getting started #
- Add
cbl
andcbl_flutter
as dependencies:
dependencies:
cbl: ...
cbl_flutter: ...
- Select the edition of Couchbase Lite you want to use, by adding as a
dependency either
cbl_flutter_ce
for the Community Edition orcbl_flutter_ee
for the Enterprise Edition:
# This dependency selects the Couchbase Lite Community Edition.
cbl_flutter_ce: ...
⚖️ You need to comply with the Couchbase licensing terms of the edition of Couchbase Lite you select.
-
Make sure you have set the required minimum target version in the build systems of the platforms you support.
-
Initialize Couchbase Lite, before using it:
import 'dart:io';
import 'package:cbl_flutter/cbl_flutter.dart';
import 'package:cbl_flutter_ce/cbl_flutter_ce.dart';
Future<void> initCouchbaseLite() async {
// On mobile platforms, `CblFlutterCe` and `CblFlutterEe` currently need to
// be registered manually. This is due to a temporary limitation in how Flutter
// initializes plugins, and will become obsolete eventually.
if (Platform.isIOS || Platform.isAndroid) {
CblFlutterCe.registerWith();
}
await CouchbaseLiteFlutter.init();
}
Default database directory #
When opening a database without specifying a directory,
path_provider
's getApplicationSupportDirectory
is used to
resolve it. See that function's documentation for the concrete locations on the
various platforms.
💡 Where to go next #
- Check out the example app in the Example tab.
- Look at the usage examples for
cbl
(go to the latest prerelease).
⚖️ Disclaimer #
⚠️ This is not an official Couchbase product.