r/FlutterDev • u/bizz84 • Oct 07 '22
Article Flutter Riverpod 2.0: The Ultimate Guide
https://codewithandrea.com/articles/flutter-state-management-riverpod/5
u/CodyLeet Oct 07 '22
Why is this called RiverPod?
16
6
6
u/Flashy_Editor6877 Oct 07 '22
nice article thx. may have to try it, seems to be a replacement for get_it? i use bloc so this might be overkill. thoughts?
also, rp2 consumers remind me of getx. you gotta admit and give credit of the power and simplicity of the magic "global variable" getx pioneered. i agree with all other problems of getx though.
1
u/plusema Oct 07 '22
Iโm also curious to know if with riverpod 2.0 we will no longer need get_it
2
1
u/Acrobatic_Egg30 Oct 10 '22
I'm sorry but this guide is not as complete as you say, it doesn't talk about the new @riverpod stuff, codegen and the new build method.
1
u/bizz84 Oct 13 '22
As I have said in the guide, I'll cover the Riverpod Generator in a separate article (coming soon!).
1
u/Acrobatic_Egg30 Oct 13 '22
I must've missed that. I read your articles religiously so I was a bit disappointed to not see explanations on the new stuff in riverpod. Felt a bit click-baity
2
u/bizz84 Oct 13 '22
Thereโs so much to cover that itโs worth splitting it into separate articles. The new generator is optional so it makes sense to cover it separately.
3
u/BewbyBewbs Oct 10 '22
Man I just don't understand riverpod. The examples everywhere are extremely simple.
2
u/pattobrien Oct 07 '22
Thanks so much Andrea! Looking forward to your riverpod_generator article too.
1
u/Flashy_Editor6877 Oct 08 '22
this is such a good guide, it's making me consider adding riverpod to my toolkit. i wish there was one like this for bloc ๐ any plans for that?
also, is rp2 fully production ready?
-10
0
Oct 07 '22
[deleted]
3
u/Kloth494 Oct 08 '22
I haven't used Riverpod by myself yet, but if Provider satisfies your needs there is no need to switch. Don't hop on the wagon because it is "standard".
1
u/Akimotoh Oct 07 '22
I would also like to know the answer to this!
u/remirousselet does this guide pass your bar of quality? :)
53
u/bizz84 Oct 07 '22
I just published an extensive and up to date guide to Riverpod 2.0.
This is way too long to share a summary, so here's the table of contents:
Why use Riverpod?
Riverpod Installation
ProviderScopeWhat is a Riverpod Provider?
Creating and Reading a Provider
Using a
ConsumerWidgetUsing a
ConsumerUsing
ConsumerStatefulWidget&ConsumerStateWhat is a
WidgetRef?Six different kinds of providers
ProviderStateProviderStateNotifierProviderFutureProviderStreamProviderChangeNotifierProviderWhen to use
ref.watchvsref.read?Listening to Provider State Changes
Additional Riverpod Features
The
autoDisposemodifierCaching with Timeout
The
familymodifierDependency Overrides with Riverpod
Combining Providers with Riverpod
Passing
Refas an argumentScoping Providers
Filtering widget rebuilds with "select"
Testing with Riverpod
How to mock and override dependencies in tests
Logging with
ProviderObserverQuick Note about App Architecture with Riverpod
Hope you find it useful!
Happy coding!