Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the model providers stateful to keep the state of the current model #58

Closed
mikuhl-dev opened this issue Feb 6, 2019 · 5 comments
Closed

Comments

@mikuhl-dev
Copy link

Using a Model on a page with a text box, the model will reset because the keyboard rebuilds the app.

@xalikoutis
Copy link

Wow having the same problem. I am trying to port an app of mine from xamarin.forms to flutter and i am having problem with reinitializing the scopemodel every time keyboard is up.

@mikuhl-dev
Copy link
Author

You can solve the issue yourself by making the models in a state.

If the provider passed the model to it's state it would have a similar effect. The model would technically be made again and the constructor would be called so any initialization stuff would be done over again and thrown away. So maybe just having a special PersistentScopedModel where the model is a builder and the provider builds the model in it's state and does not build it again.

@mikuhl-dev
Copy link
Author

I'm not sure of an occasion you would WANT the Model to reset when the app is rebuilt, so maybe the provider should take a model builder by default.

@brianegan
Copy link
Owner

Hey all -- thanks for the feedback! Overall, I think we'll be deprecating this package in favor of the provider package. It offers very similar functionality out of the box with additional goodies like StatefulProvider that solves exactly this problem.

I'd suggest trying out the provider package + StatefulProvider to see if that works for ya!

@elhe26
Copy link

elhe26 commented Mar 25, 2019

@brianegan Thanks for the heads-up! I have a question. Do we use the master branch or go for v2.0.0?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants