The solution is to pass a new Key to WidgetB every time we need it to be rebuilt : WidgetA will see that WidgetB has changed and will rebuild it when setState is called. In other words, whenever a stateful widget’s Key property changes, calling setState on its parent will force a rebuild of the stateful widget.12 Tem 2021
Read moreWhy is the build () method on state and not stateful widget?
Why is the build method on State, and not StatefulWidget? Putting a Widget build(BuildContext context) method on State rather than putting a Widget build(BuildContext context, State state) method on StatefulWidget gives developers more flexibility when subclassing StatefulWidget .
Read moreDoes a new state object is created if the widget rebuild?
The tldr version is that State objects are long lived, but StatefulWidget s (and all Widget subclasses) are thrown away and rebuilt whenever configuration changes .
Read more