I am learning Flutter. Most of the tutorials use Provider package but some others on Youtube use GetX. I searched about it and found that it seems there are another packages like Bloc, Riverpod, etc.
I am confused and don't know which one to use?
It seems GetX is simpler than Provider and has more capabilities/features like navigation, but there are not a lot of codes/tutorials using that! I wanted to know why? Also which one should I use?
EDIT: Maybe it seems this is like an opinion based question but in my opinion it's not. I want to know why most of the tutorials/open-source codes still use Provider package over GetX, Riverpod, Bloc, etc?
Is Provider an official package that Flutter supports it and safer to use? Does it have less bugs, etc? Or just it's because it was the first package most of the developers learned to use and it works for them, so they don't like to replace it with even a better one?
There are many advantages of the Provider package specially when combined with ChangeNotifiers-
Its very easy to understand and reason about. The documentation is clear and concise and provides guidelines to best practices as well. You can use both reactive and non-reactive ChangeNotifiers in a Widget which means that you can depend on other ChangeNotifiers without being notified about changes. This provides many performance benefits. You can use Provider as a simple dependency injection container as well. The only thing is, you need to have access to the BuildContext attached the widget tree.
GetX is not only a state management library, but instead, it is a microframework combined with route management and dependency injection. It aims to deliver top-of-the-line development experience in an extra lightweight but powerful solution for Flutter. GetX has three basic principles on which it is built:
Performance: focused on minimum consumption of memory and resources
Productivity: intuitive and efficient tool combined with simplicity and straightforward syntax that ultimately saves development time
Organization: decoupling business logic from view and presentation logic cannot get better than this. You do not need context to navigate between routes, nor do you need stateful widgets
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With