init static method

Future<void> init({
  1. String dbName = "secure_database.db",
  2. String tableName = "secure_data",
  3. String key = "my_secure_key",
})

Implementation

static Future<void> init({
  String dbName = "secure_database.db",
  String tableName = "secure_data",
  String key = "my_secure_key",
}) async {
  _dbName = dbName;
  _tableName = tableName;
  _key = key;

  final dbPath = await getDatabasesPath();
  final path = join(dbPath, _dbName);

  _database = await openDatabase(
    path,
    version: 1,
    onCreate: (db, version) async {
      await db.execute(
          "CREATE TABLE $_tableName (id INTEGER PRIMARY KEY, key TEXT, value TEXT)");
    },
  );
}