
All the widgets which are down the tree from this widget can now access the data and logic from the provider directly. We then make this provider available / injected to a top level widget in the application tree. In the provider way of managing the state of an application, we separate the state (data) and logic that changes the state (functions) from the widgets and keep it in a separate class usually called as provider. There are other ways such as bloc pattern, hooks etc., Provider Provider is the most popular state management tool for Flutter. There are different tools and different approaches to manage the state of an application in an efficient and easier way. Passing data through constructors from one widget to another can become a quite tedious thing even with few numbers of state variables. But most of the times the widgets that needs the data will be in different pages and different widgets. If we have all these widgets in one page/widget, then, we can manage somehow by using setState. In one widget we may want to show a welcome message, in another widget his profile, in another widget his orders and so on. Now this information may be needed at different parts inside the application. Suppose a user logs into an application which triggers a change in the state such as changing user type from ‘guest’ to ‘registered’ or any other. The most common things that causes the change are the actions taken by the user inside the application or the data received from the server. This state inside the application can change over a period of time. Now, as these frameworks or widget/component based, the data is distributed through out the application in different widgets.

Whether it is Flutter or React JS or Angular, the state of an application refers to the Data inside the application at one particular point of time. State of an Applicationīefore checking what the Provider package offers to us, first we need to understand the State of an Application. It can be easier to use the Provider package in such scenarios instead of inherited widget.

In large and complex applications it can be difficult to manage the state using this Inherited Widget. This is basically a wrapper around InheritedWidget which is normally used to manage the state of an application. Provider is the most popular and Flutters Favorite and recommended package for managing the State in Flutter applications.
