Data across the application.
WHAT THE BUILT-IN MECHANISM IS
Widget-local state, updated through the framework's notification method.
WHAT IT SUITS
State belonging to one widget.
WHAT IT DOES NOT SUIT
State shared across screens.
WHAT SHARED APPROACHES EXIST
Inherited widgets, providing values down the tree Provider-style libraries Reactive and stream-based approaches More structured state container libraries
WHAT TO CHOOSE ON
Team familiarity Application complexity Whether the team can agree one approach
WHY THAT LAST POINT MATTERS MOST
Several approaches mixed in one application is worse than any single choice.
WHAT THE PRINCIPLE IS REGARDLESS
State lifted to where it is needed, and only where it is needed.
WHAT TO KEEP LOCAL
Transient interface state.
WHAT TO AVOID
Everything in one global store Derived values stored rather than computed Rebuilding the whole tree for a small change
WHAT TO DO ABOUT REBUILD SCOPE
Place the listening widget as low as possible.
WHAT TO SEPARATE
Business logic from widgets, so it can be tested without the interface.