marcglasberg / async_redux

Flutter Package: A Redux version tailored for Flutter, which is easy to learn, to use, to test, and has no boilerplate. Allows for both sync and async reducers.
Other
230 stars 41 forks source link

type '_Directory' is not a subtype of type 'Directory' #70

Closed mohammadameer closed 4 years ago

mohammadameer commented 4 years ago

I'm trying to add persistence to my store there is no example I have used this repo it implement the persistence

https://github.com/glassp/flutter_news/tree/5c1d13c600ef986d5640c2a127ca695411bcf56b

but when trying to read the state I get this error

image _TypeError (type '_Directory' is not a subtype of type 'Directory')

and I have another question does the persistence work in browsers ?

thanks in advance

marcglasberg commented 4 years ago

The LocalPersist class uses files to persist, and as far as I know it doesn't work in browsers. But maybe it does? I am not really sure how files work for the web because I never used it. If you test it, please tell me.

In any case, AsyncRedux can just call your persistor class, and then you can persist the state difference in any way you want. The LocalPersist class is just a helper I am providing to make things a little bit easier for you, but it is not necessary.

marcglasberg commented 4 years ago

Regarding the error, are you in async_redux: 2.8.4 ?

mohammadameer commented 4 years ago

No it's 2.81

mohammadameer commented 4 years ago

the localpersist didn't work in the browser ;(

I have rebuilt the serialization and use shared preference now it's working in android and browser