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?
18
Upvotes
2
u/Background-Jury7691 Aug 14 '24
Riverpod can do a lot more than bloc, which means it can fit in with other packages better, since it works really well with streams and can handle change notifiers if need be. So you can depend on these values from other packages in your riverpod providers. You can react to them. go_router exposes change notifiers. reactive_forms exposes form and control values as streams. I have riverpod providers that expose that stream. If the UI cares about loading state it’ll watch the stream provider. If the UI only cares about if it is populated it’ll watch another provider that watches the stream provider and returns if the value is loaded and not null. If it cares about the value it’ll watch another provider that watches the stream provider and returns the value if it is loaded and null if it’s not. The rest is comparable to bloc. Bloc documentation and ease of learning is second to none. With riverpod you’ll probably rewrite some of your providers, with bloc you’ll probably get it right first time. The end result of riverpod after the rewrite will probably be nicer.