Managing State in Flutter
State management is a key aspect of working with Flutter. There are lots of different solutions with lots of different approaches. In this course, you’ll learn about the base tools provided by Flutter and then learn how to use the Google recommended state management solution, Provider. By Brian Moakley.
Learning path
This is part of the Flutter Fundamentals learning path. View path.
Who is this for?
This course is for Flutter developers who are looking to get an overview of the state management solutions included with Flutter as well as Provider, the Google recommended third party solution.
Covered concepts
- Inherited widget
- Set State
- Value Notifier
- Provider
- Change Notifier
- Multiple Providers
- Provide Extension Methods
Part 1: Understand State Management
Provides an overview of the state management, why it is important to know, and the various topics that are covered in this course.
This episode provides a comprehensive overview of state managment in Flutter. You’ll learn why it is important to know as well as some of the various solutions out there.
Learn about the sample project in this episode. You’ll see how it is built and how it is being used.
setState() is the primary method used to update set, but you’ll quickly learn that while setState will update the widget tree, it may do it in away that you don’t quite expect.
In this episode, you’ll be introduced to the ValueNotifier. You’ll learn how it works and how to use it to manage your state.
Take the ValueNotifier to the next level by extending the ValueNotifier. After which, aquire automatic updates by way of the ValueNotifierListenable widget.
Learn about the Inherited Widget - Flutter’s main component for managing state in an app. While using the Inherited Widget is relatively straight forward, there are some things to consider.
While the Inherited Widget is able to manage state it requires some work to manage mutable state. Learn how to combine a Stateful Widget with an Inherited Widget to create mutable state.
Part 2: Use Provider
Get an overview of the Provider package and how you can use it to manage the state of your app.
Learn how to use the very first Provider aptly called Provider. You’ll learn how to use this to fetch model data as well as some limitations.
While the Provider was fine for receiving model data, it didn’t react to state changes. In this episode, you’ll see how to leverage a Change Provider to receive state updates.
Provider includes a bunch of extension methods that make it easier to observe state changes as well as how to view individual properties. Learn how to use these context methods.
In this episode, learn how to leverage the consumer which unwraps your objects from a Provider, saving you some code.
Learn how to take multiple different providers and combine them into a single multiprovider that makes your code easier to read.
Learn about the other Provider features that were not covered in this course as well as some additional thoughts about using third party dependencies for your state management.