Provider Package

Learn about the provider package, which will be used for state management.

We'll cover the following...

Since the provider is a third-party package, we need to install it first.

Add dependency

To add a provider, run the following command in the terminal inside the project folder. This will add the package in pubspec.yaml.

flutter pub add provider

How it works

The provider provides something to its underlying widget. We know that in Flutter we have widget trees that make up our whole UI, so a provider providing something at one node will be known by all of its child widgets. This is the key fundamental in the provider package. And what does it provide? Its actual state or value. ...