init static method Null safety

Future<void> init(
  1. {required Edition edition,
  2. String? filesDir,
  3. String? nativeLibrariesDir}

Initializes the cbl package, for the main isolate.

If specified, filesDir is used to store files created by Couchbase Lite by default. For example if a Database is opened or copied without specifying a, a subdirectory in the directory specified here will be used. If no filesDir directory is provided, the working directory is used when opening and copying databases.

If the native libraries have not been downloaded yet, this method will download them and store them in nativeLibrariesDir. If no directory is provided, a system-wide default directory will be used. nativeLibrariesDir should be within the directory where apps should store cached data on the current platform.


static Future<void> init({
  required Edition edition,
  String? filesDir,
  String? nativeLibrariesDir,
}) =>
    asyncOperationTracePoint(, () async {
      final context = filesDir == null ? null : await _initContext(filesDir);

      final libraries = await acquireLibraries(
        edition: edition,
        mergedNativeLibrariesDir: nativeLibrariesDir,

      await initPrimaryIsolate(IsolateContext(
        initContext: context,
        libraries: libraries,