lesnitsky / flutter_localstorage

📦 LocalStorage for Flutter
MIT License
301 stars 60 forks source link

deleteItem exception #55

Closed doc-rj-celltrak closed 3 years ago

doc-rj-celltrak commented 3 years ago

In 3.0.4+7, calling deleteItem() crashes in flush() if there is no file (nothing has been written yet).

flutter: NoSuchMethodError: The method 'lock' was called on null. Receiver: null Tried calling: lock() flutter:

0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)

1 DirUtils.flush (package:localstorage/src/directory/io.dart:46:25)

2 LocalStorage._flush (package:localstorage/localstorage.dart:103:18)

3 LocalStorage.deleteItem (package:localstorage/localstorage.dart:92:12)

doc-rj-celltrak commented 3 years ago

Hmmmm, we're seeing the issue with setItem() too, even though we are awaiting ready during initialization.

flutter: NoSuchMethodError: The method 'lock' was called on null. Receiver: null Tried calling: lock() flutter:

0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)

1 DirUtils.flush (package:localstorage/src/directory/io.dart:46:25)

2 LocalStorage._flush (package:localstorage/localstorage.dart:103:18)

3 LocalStorage.setItem (package:localstorage/localstorage.dart:86:12)

===

final storage = LocalStorage('redux.json', cttPath); await storage.ready; ...

PerLycke commented 3 years ago

Same issue here after updating from 3.0.3+6 to 3.0.4+7

Stevensie95 commented 3 years ago

Try to change version from ^3.0.4+7 to ^3.0.4

lesnitsky commented 3 years ago

please check v3.0.5

lesnitsky commented 3 years ago

sorry for the inconvenience