create static method
Creates instance for SecurityClient for name
with password
.
Returns Future of SecurityClient
.
If an instance with the given name
was already created, it will only open the database for it.
final SecurityClient globalSecurityClient = await SecurityClient.create("global", "...");
final SecurityClient userSecurityClient = await SecurityClient.create("user_1", "...");
Implementation
static Future<SecurityClient> create(final String name, final String password) async {
final database = await openDatabase(
join(await getDatabasesPath(), "$name.db"),
password: password,
version: 1,
onCreate: (database, version) {
return database.execute(
"CREATE TABLE $_keysTable($_keysTableKeyColumn TEXT PRIMARY KEY, $_keysTableValueColumn TEXT)",
);
},
);
return SecurityClient._(database);
}