Sparround

Choosing: comparison and decision

In a state-management question the interviewer is looking for a decision framework, not package trivia. Start by classifying the state:

  • Ephemeral (local) state — belongs to one widget: form text, an expanded panel, an animation. Here `setState` is the right choice and no package is needed
  • App state (shared) — spans screens: authentication, the cart, settings, caches. Only this needs a package

Flutter's own documentation opens with exactly this distinction, and moving everything into a package is not what it recommends.

CriterionsetStateProviderRiverpodBLoC
Learning costNoneLowModerateHigh
BoilerplateNoneLittleLittleA lot
TestabilityWeakGoodVery goodVery good
Compile-time safetyWeakStrongModerate
FitsOne widgetSmall to mid appMid to largeLarge, team-built

Interview tip. Do not answer "which state management do you use?" with one word. A strong structure: (1) explain the local/shared split first; (2) say what the current project uses and why it was chosen; (3) acknowledge the alternatives' strengths, which shows you are not dogmatic. The worst answer is "X is the best"; the best is "it depends on context, and in ours X was chosen for these reasons".

📚 Sources and documentation