1
0 Comments

Provider and Immutable Objects in Flutter

Solved hard bug that hit for my Flutter app development. It was caused by my change it use immutable objects (freezed library) and provider. Thanks to the hard debugging, I learned how to use Chrome’s Flutter inspector’s widget tree as well as widget’s build methods.

Stateless widgets’ build methods are called without the class’s constructor. This may show staled data if the constructor argument is kept a instance of the widget and Its build method uses it.

Stateful widget’s build methods are not automatically called when its parent widget is being rebuilt. For example, I updated a widget through a ValueNotifier but one of its children remained the same even though the argument to the widget is updated. To update the tree’ it must call the setState method.

posted to Icon for group Developers
Developers
on March 8, 2020
Trending on Indie Hackers
AI runs 70% of my distribution. The exact stack. User Avatar 148 comments I'm a solo founder. It took me 9 months and at least 3 stack rewrites to ship my SaaS. User Avatar 137 comments Show IH: I'm building a lead gen + CRM tool for web designers targeting local businesses without websites — starting with Spain User Avatar 79 comments I built a URL indexing SaaS in 40 days — here's the honest story User Avatar 58 comments We could see our AI bill, but not explain it — so I built AiKey User Avatar 25 comments AI coding should not turn software development into a black box User Avatar 13 comments