Browse Source

[example] Add catch sqflite

embedder_texture
Vitaliy Zarubin 1 year ago
parent
commit
3413ecd9a3
  1. 5
      example/lib/packages/sqflite/model.dart

5
example/lib/packages/sqflite/model.dart

@ -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

Loading…
Cancel
Save