Differentiate setState and Provider.
setState()
We use it for managing the local state in a similar stateful widget and its child. The downside is everything is in the same class like UI code, business logic, and mixin UI, which splits clean code principles.
Provider
In the provider pattern, we define everything in a separate class indicating that the UI presentation is defined in the different logics that specify different thus code appears high quality and clean. Moreover, we don’t need to transmit the state from one screen to another through the constructor.
- The business Logic Component(BLoC) pattern is a common way to manage the state in Flutter apps. You may be asked questions about it in the interview.
