filmov
tv
Managing state in Flutter with Provider (Version 3)
Показать описание
There are several ways to manage state in Flutter. My personal favorite is a package called Provider. It allows you to inject the state into a widget and its children. This video will explain how to selectively rebuild widgets in a widget tree using the Provider, Consumer, and Selector classes. There is a lot more that isn't covered in this video, but this should get you comfortable with basics of the Provider package.
*Error around 14:50. I meant "enclosing widget", not "surrounding widget"
00:00 - Intro
00:40 - Reviewing the current code
02:11 Creating the first ChangeNotifier class (FoodNotifier)
04:25 Using ChangeNotifierProvider to register the FoodNotifier
05:34 Refactoring the home page to use the FoodNotifier
08:30 Showing the FoodNotifier list in the list page
10:27 Creating a 2nd Change Notifier (UserNotifier)
12:26 Using MultiProvider for multiple providers
14:00 Adding the UserNotifier to the List page
18:02 Using the Consumer widget
20:37 Explaining the very important 'listen' flag
21:42 Using the Selector widget
25:03 Using both the Consumer and Selector with the same ChangeNotifier
*Error around 14:50. I meant "enclosing widget", not "surrounding widget"
00:00 - Intro
00:40 - Reviewing the current code
02:11 Creating the first ChangeNotifier class (FoodNotifier)
04:25 Using ChangeNotifierProvider to register the FoodNotifier
05:34 Refactoring the home page to use the FoodNotifier
08:30 Showing the FoodNotifier list in the list page
10:27 Creating a 2nd Change Notifier (UserNotifier)
12:26 Using MultiProvider for multiple providers
14:00 Adding the UserNotifier to the List page
18:02 Using the Consumer widget
20:37 Explaining the very important 'listen' flag
21:42 Using the Selector widget
25:03 Using both the Consumer and Selector with the same ChangeNotifier
Комментарии