flutter_localstorage: Data doesn't persist in latest version, does in 2.0.0 (android)
Hi, I’ve been using this package but somehow with version 3.0.4 data wouldn’t persist. here’s my code:
final storage = LocalStorage('my_data.dart');
await storage.ready.then((_) => {myVar = storage.getItem("myVar")});
//if myVar is null I set it here~
tried running on my android 10 phone, data wouldn’t persist, even if I installed the app. Tried changing my_data.dart to only my_data or anything else, wouldn’t work as well. No error/exception was thrown either. On a whim I thought I’d try to update the pubspec and set the package’s version to 2.0.0, that worked. Now the data is persisting between hot reloads as it should.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 8
- Comments: 20 (8 by maintainers)
I managed to get v3.0.0 working by awaiting on its readiness before fetching / updating data, so using a FutureBuilder or simply await should fix this. Apparently they changed something within the latest stable flutter update, as even v2.0.0 I had been using thus far wouldn’t be loaded properly any longer now. Anyway, as it seems to work fine now, I’ll go ahead and close this. thank you @lesnitsky for the support.
This has not yet been solved
same issue! is it solved?