The Provider Library Fundamentals
Learn what a provider library is and how you can use the "Provider.of<T>" method.
We'll cover the following...
What is the Provider
package
What is the Provider
in Flutter?
The Provider
is a Flutter package. It’s a wrapper around the InheritedWidget
.
Before we proceed, we must add the dependency on the provider
to the pubspec.yaml
file.
It looks like this:
dependencies:flutter:sdk: flutterprovider:
Now you are set to use the provider
to manage a state in your app.
What is a state? The state is something that exists in memory. When the app is running, in most cases, we will try to manage the state. The Provider
helps you to do that.
The state itself is critical, while efficiently managing it is essential too.
That’s because managing state is crucial to building any complex app that handles multiple screens, different variables, and user sessions. Hence, ...