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.