buildIsarService static method

Future<Isar> buildIsarService()

Implementation

static Future<Isar> buildIsarService() async {
  final dir = await getApplicationDocumentsDirectory();

  var isarInstance = Isar.getInstance('cosmos_epub');

  if (isarInstance == null) {
    final isar = await Isar.open(
      [BookProgressModelSchema],
      name: 'cosmos_epub',
      directory: dir.path,
    );

    IsarService._create(isar);
    return isar;
  } else {
    return isarInstance;
  }
}