dont lock forever if has error
MODIFY
lib/src/cache/in_memory.dart
lib/src/cache/in_memory.dart
@@ -64,13 +64,12 @@ class InMemoryCache implements Cache {
}
Future<dynamic> _writeToStorage() async {
- if (!_writingToStorage) {
- _writingToStorage = true;
- } else {
+ if (_writingToStorage) {
return;
}
+ _writingToStorage = true;
+ try {
final File file = await _localStorageFile;
-
final IOSink sink = file.openWrite();
_inMemoryCache.forEach((String key, dynamic value) {
@@ -78,6 +77,9 @@ class InMemoryCache implements Cache {
});
await sink.close();
+ } catch (err) {
+ // TODO: handle error
+ }
_writingToStorage = false;
return;
}

dont lock forever if has error