DEV Community

Cover image for Avoid state management package in Flutter
Rafat Jamader Meraz
Rafat Jamader Meraz

Posted on

Avoid state management package in Flutter

State management is one of the best hot topic in Flutter. In community nowadays most common question is- "What package should use for state management?". Specially beginner are really confused.

As I have mentioned in my title that you should avoid state management package for your next big project. There are some fancy way to avoid these package so that our project is not depend on a third party package which is maintain by community. Sometimes a major change is happens in these packages and we face a huge list of errors and warning by that time.

Then what's the solution for state management in Flutter? So answer is reactive programming. As you already know that Flutter provides Stream & StreamBuilder for Asynchronous programming. So you can use these features to make your app more reactive. With these feature you can also use a small package which is get_it as Service locator.

Another advice is to use Stateful Widget. Many of us are afraid of use Stateful widget because they think that will create a performance issue. But in few cases like a screen only rebuild for one/twice then you can use it. You don't need to write a huge number of boilerplate code to manage this simple task with a state management package like BLoC. Use Asynchronous programming for those screens or part of screen where it need to rebuild a several times.

Discussion (0)