|
|
@ -31,6 +31,7 @@ class SqfliteModel extends Model { |
|
|
|
|
|
|
|
|
|
|
|
/// Init database |
|
|
|
/// Init database |
|
|
|
Future<void> init() async { |
|
|
|
Future<void> init() async { |
|
|
|
|
|
|
|
try { |
|
|
|
// Get a location using getDatabasesPath |
|
|
|
// Get a location using getDatabasesPath |
|
|
|
var databasesPath = await getDatabasesPath(); |
|
|
|
var databasesPath = await getDatabasesPath(); |
|
|
|
String path = p.join(databasesPath, 'demo.db'); |
|
|
|
String path = p.join(databasesPath, 'demo.db'); |
|
|
@ -51,6 +52,10 @@ class SqfliteModel extends Model { |
|
|
|
)'''); |
|
|
|
)'''); |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
_error = e.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
notifyListeners(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Close database |
|
|
|
/// Close database |
|
|
|