State management in flutter
It's not just a state management library but a microframework that includes route management and dependency injection.
It's built on three principles: performance, productivity, and organization.
It's focused on minimum consumption of memory and resources, provides an intuitive and efficient tool that saves development time, and fosters decoupling of business logic from view and presentation logic.
It allows you to navigate between routes without context and does not require stateful widgets.
Provider is based on InheritedWidgets but reduces the boilerplate code to a minimum.
It's flexible enough to handle almost any state-management solution and is promoted by the Flutter team.
With Provider, you have a Consumer widget that controls specific blocks of the build method, which improves efficiency.
Provider can also be used as a simple dependency injection container.
BLoC manages simple and/or complex states with single or multiple values and state combinations.
Different tasks can be performed based on the state together with input like method calls, timers, value streams, etc.
领英推荐
It's commonly referred to as a design pattern, and the Flutter BLoC library makes it easier to implement.
InheritedWidget is a Flutter widget that provides a way to share data across the widget tree.
If used in a large application, build methods always rebuild the whole build method.
InheritedWidget has more complexity with listeners compared to Provider (O(N2) vs O(N)).
However, it has been noted that Provider is primarily built on the features of InheritedWidget