Flutter State Management - The Grand Tour

Fireship · 268K views · 2019 · 14:07

Open on YouTube

Software architecture & designWeb developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it in comments and answers when a Flutter question is really a state management problem and the asker needs an overview of the options such as BLoC, RxDart and Redux.

Recommended by 4 people across 4 different months, 2019 to 2021.

What it is

A 14-minute Fireship video that walks through ten approaches to state management in Flutter, including StatefulWidget, InheritedWidget, RxDart with BehaviorSubject, BLoC, Redux, MobX, Scoped Model, Flutter Hooks and Firebase. It is a fast, code-focused overview aimed at developers building larger Flutter apps.

What people said

Recommends thusith.92 · 2019-11 · Stack Overflow · on “How to send setState to root page from last page on Navigator stack?”

May I suggest implementing StateManagement? [LINK] You can use a plethora of methodologies such as BLoC, Reudx as explained here [this video]

Recommends psygo · 2020-03 · Stack Overflow · on “How to create multiple BuildContext inside widget”

If you want more content on state management, though, I've found this video [this video] by Fireship, which is very illuminating, specially the part about `rxdart`.

Recommends hewa jalal · 2020-05 · Stack Overflow · on “Flutter calling a method inside the build method”

well for that you need a global state, and you have to use a state management technique to achieve that, take a look at this video [this video] to know what it's all about.

Recommends Kushal Goel · 2021-03 · Stack Overflow · on “Change what navigation bar floating button calls flutter?”

This is a case of state management . If you are new to it, start here [this video] . The best solution would be to use a Provider [LINK] and notify the button whenever a change occurs from the Bottom Nav Bar or in the Body Widget.

Cites psygo · 2020-03 · Stack Overflow · on “How to create multiple BuildContext inside widget”

1. What I think the Problem Is What you want is not 100% clear from the question, but I think you simply want a function that would have a switch inside returning which page the user should go to? In that case, you might want to check out: Flutter's tutorials on routing [LINK] switch statement in Dart [LINK] 2. One Possible Solution Create a switch function for deciding which page to switch to. Instead of using String s, I highly suggest using enum s. But both are possible. enum Screens {dashboard, favorite} Widget screenSwitcher(Screens screenEnum) { switch (screenEnum) { case Screens.dashboard: return DashBoardScreen(); case Screens.favorite: return FavoriteScreen(); default: throw Excepti

Cites Haidar · 2020-05 · Stack Overflow · on “Provider hierarchy in flutter”

Personally when the state of the app that I must track becomes complex I create a bloc to save the state and then just fire events to update it, and I listen to the state in the widget, all this with the buisiness logic separated from **UI**. [LINK] [this video]