initDB static method
Initializes the database on the current isolate. Used by both the worker and test environment for accessing data from the DB.
Implementation
static Future<Database> initDB() async {
final databasesPath = await getDatabasesPath();
String path = join(databasesPath, dbName);
return openDatabase(
path,
version: dbVersion,
singleInstance: false,
onCreate: (db, version) async {
await db.execute(
'''
CREATE TABLE $tableName (
$keyColumn TEXT PRIMARY KEY,
$valueColumn TEXT
)
''',
);
},
);
}