Flutter - State Management

Table of Contents

Local state - State that can be contained within a single widget. Local or ephemeral state. setState & Stateful widget. State that only effects a single widget.

Global / Shared state - State that is share across multiple widgets. Options include: Flutters built in Inherited Widget. Change Notifier, Value Notifier, StreamBuilder & FutureBuilder

Best practice is to check for 4 state of UI:

  • Data
  • NoData
  • Error
  • Loading

Stream Builder offers some capabilities but its clunky

References