openDatabaseMiniAsync method

Future<DatabaseMiniGeneralLibrary> openDatabaseMiniAsync({
  1. required String key,
  2. required DatabaseMiniGeneralLibraryBaseOptions databaseMiniGeneralLibraryBaseOptions,
  3. required Map defaultData,
})

Implementation

Future<DatabaseMiniGeneralLibrary> openDatabaseMiniAsync({
  required String key,
  required DatabaseMiniGeneralLibraryBaseOptions
      databaseMiniGeneralLibraryBaseOptions,
  required Map<dynamic, dynamic> defaultData,
}) async {
  final DatabaseMiniGeneralLibrary? databaseMiniGeneralLibraryOld =
      _stateDbMini[key];
  if (databaseMiniGeneralLibraryOld == null) {
    final DatabaseMiniGeneralLibrary newDatabaseMiniGeneralLibrary =
        DatabaseMiniGeneralLibrary();
    newDatabaseMiniGeneralLibrary.ensureInitialized(
      pathToFile: key,
      databaseMiniGeneralLibraryBaseOptions:
          databaseMiniGeneralLibraryBaseOptions,
    );
    await newDatabaseMiniGeneralLibrary.initiaLized(
      defaultData: defaultData,
    );
    _stateDbMini[key] = newDatabaseMiniGeneralLibrary;
    return newDatabaseMiniGeneralLibrary;
  }
  return databaseMiniGeneralLibraryOld;
}