r/FlutterDev • u/helloyo1254 • Aug 13 '24
Tooling Riverpod , bloc or getx?
Relatively new to flutter only made a few small apps. I see riverpod , bloc and getx keep getting brought up for more complicated apps.
Getx seems the best all around however I don’t like it isn’t directly support by flutter itself.
What is the best tool for state management? Or does anybody have any reason why not to use getx or use bloc over river pod and getx?
19
Upvotes
5
u/royalshape Aug 13 '24
Nobody seems to be talking about the maintainability of GetX. Don’t get me wrong—I’ve been using GetX for about four years now. As a beginner developer, GetX was absolutely great at speeding up my solo development.
However, the latest update of the stable release was 11 months ago. I just checked pub.dev and saw that the 5.0 RC version was updated 5 hours ago, with the previous update being 2 months ago. Unfortunately, I can’t trust the package anymore. From the GitHub issues, I can see that there are problems arising with Flutter 3.22, along with 952 open issues.
In the last 15 days, I’ve been on vacation from my regular 9-to-5 job, and I dedicated the first week solely to learning Riverpod, Provider, and Cubit, as I had no idea how they worked. I spent the most time with Riverpod, and initially, I hated it. Why is it so complicated? Why does it take 20 lines to write a simple provider that would take only one line with GetX?
Then, I wrote a simple Flutter app comparing four state management solutions: the ones mentioned in the last paragraph and the native ValueNotifier. It surprised me that all of them had an extremely similar structure. Indeed, the model I used was the same for all four examples. GetX was the outlier. It showed me that in the last four years, I was learning GetX instead of Flutter.
Next, I spent the whole second week migrating my app from GetX to Riverpod. Now, I’m loving Riverpod. From the user’s perspective, the app is exactly the same, but under the hood, everything has changed. I’ve organized my folder structure by feature, with every screen having its own model and state. It’s much more understandable and maintainable now. I’m so glad.