lesnitsky / flutter_localstorage

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

No loaded items after updating to 3.0 #30

Closed nohli closed 4 years ago

nohli commented 4 years ago

Thanks for this package, I really like localstorage and never had issues before.

After updating to 3.0.0+2 my app did not load any items with the following code:

final LocalStorage storage = LocalStorage('filename');

  Widget build(BuildContext context) => FutureBuilder(
        future: storage.ready,
        builder: (BuildContext context, snapshot) {
          if (snapshot.hasData) {
            storage.getItem('listname');
            ...

Does loading have to be async now - and how do I implement it?

lesnitsky commented 4 years ago

@nohli are you using this plugin on desktop or mobile?

nohli commented 4 years ago

On mobile, only tried on iOS 13.1.3 actually.

Latest Flutter stable.

lesnitsky commented 4 years ago

Do you mean that you can't get items after successful setItem, app reload or after upgrading to v3? (meaning v2 worked fine, you had some data on device, but can't retrieve this data using v3)

On Sat, Oct 26, 2019, 8:15 PM nohli notifications@github.com wrote:

On mobile, only tried on iOS 13.1.3 actually.

Latest Flutter stable.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lesnitsky/flutter_localstorage/issues/30?email_source=notifications&email_token=ABPYUNRVGJAWUR5C7KEUQ5LQQR3LRA5CNFSM4JFMDURKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECKMWWA#issuecomment-546622296, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPYUNQAEDYVXIDQOTWZWEDQQR3LRANCNFSM4JFMDURA .

nohli commented 4 years ago

Latter

I downgraded to 2.0.0 and it loaded the lists. Upgraded again and it didn‘t load.

lesnitsky commented 4 years ago

Ok, I will investigate However major version bump (2 -> 3) usually implies breaking change

On Sat, Oct 26, 2019, 9:18 PM nohli notifications@github.com wrote:

Latter

I downgraded to 2.0.0 and it loaded the lists. Upgraded again and it didn‘t load.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lesnitsky/flutter_localstorage/issues/30?email_source=notifications&email_token=ABPYUNWHZOX4MP5CWV4DUWDQQSCXFA5CNFSM4JFMDURKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECKN43I#issuecomment-546627181, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPYUNUGLE3XSOE7B6FQUGTQQSCXFANCNFSM4JFMDURA .

nohli commented 4 years ago

Yeah of course, just wanted to let you know. (the readme says breaking change for desktop only)

Maybe there is an option for my users not to lose all their data and updating.

I‘m really fine with 2.0 which works great.

Thanks for the plugin and replying!

tehort commented 4 years ago

I also have the same problem, iOS 13.2, had to roll-back to version 2.0.0 Doesn`t happen with Android and 3.0.0

nohli commented 4 years ago

Any news?

It seems like you've changed the path or something.

If I upgrade, the old lists are gone. I can save new lists. If I then downgrade, the new lists are gone, and the old lists appear. So I have two localstorages, depending on the version (2 or 3).

Any chance to easily migrate through your package?

lesnitsky commented 4 years ago

@nohli I found the root cause, v3.0 doesn't add .json extension, so if you want to use data saved using v2 you need to add .json extension on your own

so if v2 code was final storage = new LocalStorage('my_data') v3 equivalent would be new LocalStorage('my_data.json')

I'm adding this to readme

lesnitsky commented 4 years ago

@nohli https://github.com/lesnitsky/flutter_localstorage#v2---v3-migration

nohli commented 4 years ago

That's great, thanks!! Easy fix :)