create static method
Implementation
static Future<LcpDatabase> create() async {
Database database = await openDatabase(
'lcpdatabase.db',
version: 1,
onCreate: (Database db, int version) async {
await db.execute('''
create table if not exists ${LicensesTable.name} (
${LicensesTable.id} text primary key,
${LicensesTable.printsleft} integer not null,
${LicensesTable.copiesleft} integer not null,
${LicensesTable.registered} integer)
''');
await db.execute('''
create table if not exists ${TransactionsTable.name} (
${TransactionsTable.id} text primary key,
${TransactionsTable.origin} text null,
${TransactionsTable.userid} text null,
${TransactionsTable.passphrase} text null)
''');
},
);
Licenses licenses = Licenses(database);
await licenses.loadData();
Transactions transactions = Transactions(database);
_database = LcpDatabase(licenses, transactions);
Fimber.d("_database: $_database");
return _database;
}