diff --git a/lib/platform/web/indexed_db.dart b/lib/platform/web/indexed_db.dart index 6cff1b2..3406640 100644 --- a/lib/platform/web/indexed_db.dart +++ b/lib/platform/web/indexed_db.dart @@ -48,6 +48,7 @@ class IndexedDb { } Future init() async { + if (_inited) return; makeStoragePersist(); final req = version != null ? window.indexedDB.open(dbName, version!) @@ -156,6 +157,10 @@ class IndexedDb { } await Future.microtask(waitResult); + if (!ok) { + _inited = false; + throw req.error ?? ""; + } } Future openKeyCursor(String table, void Function(IDBCursor) callback, @@ -193,6 +198,10 @@ class IndexedDb { } await Future.microtask(waitResult); + if (!ok) { + _inited = false; + throw req.error ?? ""; + } } Future put(String table, JSAny value, {JSAny? key}) async {