database property

Future<Database> get database

Implementation

static Future<Database> get database async {
  if (_database != null) {
    return _database!;
  }

  if (kIsWeb) {
    var factory = databaseFactoryWeb;
    _database = await factory.openDatabase(dbName);

    return _database!;
  } else {
    // get the application documents directory
    final dir = await getApplicationDocumentsDirectory();

    // make sure it exists
    await dir.create(recursive: true);

    // build the database path
    final dbPath = join(dir.path, dbName);
    // var codec = getEncryptSembastCodec(password: '[your_user_password]');

    _database = await databaseFactoryIo.openDatabase(dbPath);

    return _database!;
  }
}