Awesome video, I’ve been developing over 20 years, new to flutter and watched many videos on riverpod and just couldn’t get my head around it. Your videos finally made it click, great examples look forward to seeing your future videos
@@FunwithFlutter Been developing 10 yrs and same with me. Could not quite get my head totally around it, but these finally made it click for me. Thanks!
Thanks Raja. I use ScreenFlow, only available on Mac I think. They recently released a new version (I'm still on the old one). Really good software and you can easily do some cool things with it. High res recordings, can zoom in, keystroke capture, highlights. Good investment.
Hi Broo! You is nice mastery! I can ask about "Wave_slider" ... when a you have plan to abrade this plugin? Flutter 2.5 not accept it because plugin is " not null safety" ...
Does riverpod help to solve such a problem where I need to pass any primitive like double down 2/3 widgets? I break my widgets many parts and I struggle when animation I just need one single primitive I can't do it with provider because it's generic.
Great video. Question, is the intention now that for me to only read a provider, I need access to WidgetRef, right? So there is no alternative, like there was before with context.read which could be used from inside Stateless widget. Or do I have to be inside either a ConsumerWidget/ConsumerStatefulWidget/Consumer, in order to just to a read?
ref.listen won't cause the build function to be called again. Which is something you want to avoid, as a general practice. ref.listen also mean you can manipulate state easily on certain events that come through
one more follow up question, if I am doing a ref.listen of the same provider in several different pages (navigator 2.0), how do I prevent rebuilds in all those pages? I'd ideally like to rebuild only when they become visible.
Thanks for tutorial man. Can I ask you something about ProviderListener/ref.listen, I have two login provider listener at two different file (for login screen and after register confirmation screen), but register confirmation screen listening to Login ProviderListener from the file itself and also from from login screen. How to make ProviderListener only be listened locally (only same file/screen)?
Hmmm depends, but some things you can look into are making the providers private (so _ ), only access them in that file then. And the also adding autodispose to the providers, so that they are destroyed when they are no longer being referenced
@@FunwithFlutter I'm still confused with making providers private, the thing is my provider is in different file with my screen, can you explain me more about it? And I was already adding autodispose to the providers.
Instead of sending a BuildContext to the button, you would now send the WidgetRef - for ConsumerWidget's. While for ConsumerStatufulWidget the WidgetRef is a property of the ConsumerState class, so you can use ref.read anywhere in that class.
@@FunwithFlutter Thanks. So If (as an example) I have a Scaffold with a body :Column() with children: [button1(), button2()]. Where should I put the consumer? Do all my scaffolds need to have consumer children from now on?
No you replace your SatelessWidget with a ConsumerWidget, get the WidgetRef in the build method, and there you go. You can use the ref wherever you want in your build. The Consumer widget is independent and serves a different purpose
Awesome video, I’ve been developing over 20 years, new to flutter and watched many videos on riverpod and just couldn’t get my head around it.
Your videos finally made it click, great examples look forward to seeing your future videos
Ah that's great to hear! Glad they were helpful!
@@FunwithFlutter Been developing 10 yrs and same with me. Could not quite get my head totally around it, but these finally made it click for me. Thanks!
@@deepertracks That's great to hear. You're welcome!
Truly Awesome Video!!!!
Thank you. very helpful video
You’re very welcome!
you are using watch. Where as WidgetRef is shown in original documentation. What is correct?
already subscribe you channel Bro, keep teaching and make good tutorials....
Thanks!
Hey, Great content as always. Thanks man.. !! (On a slightly off topic note, what's the screen recorder you use to capture the screen?)
OBS studio is good if you want to make such thing
Thanks Raja. I use ScreenFlow, only available on Mac I think. They recently released a new version (I'm still on the old one). Really good software and you can easily do some cool things with it. High res recordings, can zoom in, keystroke capture, highlights. Good investment.
Nice resume. Select is awesome
Yeah for sure. Riverpod keeps getting better.
@@FunwithFlutter but I don't know if it optimizes because any animations triggers needsrepaint several times a second
@@peekpt What's the concern using select in a build where there is animation, or using select to do animation?
Hi Broo! You is nice mastery! I can ask about "Wave_slider" ... when a you have plan to abrade this plugin? Flutter 2.5 not accept it because plugin is " not null safety" ...
Thank you
:)
Does riverpod help to solve such a problem where I need to pass any primitive like double down 2/3 widgets? I break my widgets many parts and I struggle when animation I just need one single primitive I can't do it with provider because it's generic.
Great video. Question, is the intention now that for me to only read a provider, I need access to WidgetRef, right? So there is no alternative, like there was before with context.read which could be used from inside Stateless widget. Or do I have to be inside either a ConsumerWidget/ConsumerStatefulWidget/Consumer, in order to just to a read?
Thanks! And yes, you're correct. You would now always need some ref to perform a read. No longer possible with context.
@@FunwithFlutter Good to know! Just refactored my current project to use the latest, your video was very helpful. Thanks again.
@@oscarh4066 You're very welcome!
Now if only Navigator 2.0 wasnt an absolute PAIN to manage
I still don't understand the difference between ref.watch and ref.listen, and use cases for each. Can you further explain?
ref.listen won't cause the build function to be called again. Which is something you want to avoid, as a general practice. ref.listen also mean you can manipulate state easily on certain events that come through
one more follow up question, if I am doing a ref.listen of the same provider in several different pages (navigator 2.0), how do I prevent rebuilds in all those pages? I'd ideally like to rebuild only when they become visible.
.autoDispose on the provider
@@FunwithFlutter thanks, but if a page is pushed onto the navigation stack, it is not disposed. it only is disposed when popped off.
Thanks for tutorial man. Can I ask you something about ProviderListener/ref.listen, I have two login provider listener at two different file (for login screen and after register confirmation screen), but register confirmation screen listening to Login ProviderListener from the file itself and also from from login screen. How to make ProviderListener only be listened locally (only same file/screen)?
Hmmm depends, but some things you can look into are making the providers private (so _ ), only access them in that file then. And the also adding autodispose to the providers, so that they are destroyed when they are no longer being referenced
@@FunwithFlutter I'm still confused with making providers private, the thing is my provider is in different file with my screen, can you explain me more about it? And I was already adding autodispose to the providers.
So what do I replace context.read() with in my buttons' onPressed functions? Do i have to wrap my buttons in consumer widgets now?
Instead of sending a BuildContext to the button, you would now send the WidgetRef - for ConsumerWidget's. While for ConsumerStatufulWidget the WidgetRef is a property of the ConsumerState class, so you can use ref.read anywhere in that class.
@@FunwithFlutter Thanks. So If (as an example) I have a Scaffold with a body :Column() with children: [button1(), button2()]. Where should I put the consumer? Do all my scaffolds need to have consumer children from now on?
No you replace your SatelessWidget with a ConsumerWidget, get the WidgetRef in the build method, and there you go. You can use the ref wherever you want in your build. The Consumer widget is independent and serves a different purpose
@@FunwithFlutter Using the ref in the build method will cause the whole build to rebuild, correct?
Thanks for this! are there any examples of ConsumerStatefulWidget?
You’ll find some in the repository!
@@FunwithFlutter Thanks, I'm sorry but I can't find the examples in the repository you are referring to. Can you point me to one?
@@matthewchung74 You'll find one here: github.com/funwithflutter/riverpod_tutorials/blob/main/riverpod_003_async_value/lib/main.dart
@@matthewchung74 There are others in the same repo.
Thank you for this tutorial.
please do make
- a tutorial with flutter_riverpod and connectivity pkg.
and more logic topic use by flutter_riverpod
we are now at dev release 1.0.0-dev.7, which is mostly bug fixes