简体   繁体   中英

How to manage state in flutter?

I have a page from which I navigate to another page and do something there , when I press back button, the current page simply pop and previous page keep as it is. I have to refresh it to make changes. I want, when I make change to second page, first page should automatically get updated according to it.

You should read a little about managing state in flutter.

There are few very good ideas on how to approach this problem.

You can try with fairly simple Scoped Model .

or little bit more confusing Inherited widgets . If you ever used Theme.of(context) or Navigator.of(context) that is basically inherited widget. Just a little more harder to set up properly.

Check this amazing presentation on managing it from google io 2018 https://youtu.be/RS36gBEp8OI

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM