Flutter Riverpod Tutorial - The Better Provider
Вставка
- Опубліковано 4 лют 2025
- 📗 Learn from the written tutorial 👇👇
resocoder.com/...
📧 Get Flutter news 📰 and resources:
👉 flutter.education
👨💻 Do you write good code? Find out now!
resocoder.com/...
Riverpod is the response to all the insufficiencies of other dependency injection and state management packages for Dart & Flutter apps. It's quick to get familiar with, maintainable, testable and it's much less error-prone than the other solutions out there. Let's take a look at the core principles of Riverpod.
Go to my website for more information, code examples, and articles:
● resocoder.com
Follow me on social media:
● / resocoder
● / resocoder
● / resocoder
Time for riverpod playlist!!!
I am always impressed by your arguments when teaching stuff. Hearing “one of the problems with Provider is injecting dependencies through the UI”, may not seem like much, but it has a deeper meaning that you have, at least, tried to build real production apps, with a well-designed architecture (followed your clean architecture tutorials as well, just as awesome as this one). This is what the community needs.
Being a flutter dev that works on full scale production projects, I can see that your arguments discuss non trivial issues of real (reads production) architecture applications, unlike almost all other flutter tutorials. Thanks a lot!
best explanation I have found on this topic on youtube.....thanks
You're the best!! Looking forward for a TDD + CleanArchitecture + Riverpod series!!!
This is the best tutorial for riverpod on UA-cam. Thank you
If you’ve stumbled around the web copying code as the ‘instructor’ builds an app, and (like me) wondered if anyone TEACHES … lucky you, you’ve found him! Matt (Reso Coder) is hands-down the best teacher I’ve found, in terms of presentation, depth, topics, and his intent for students to write flutter apps professionally.
Thanks for the tutorial, it's really easy to understand.
One thing about ref.watch vs. ref.read, the Riverpod docs suggest always using ref.watch where possible. Because even if you think a variable will never change, it might change in the future and cause bugs that are hard to debug.
damn! this riverpod is cleaner to implement than provider! time to refactor my project. thank you!
Fantastic teaching on Riverpod, thank you very much!
Need tutorial on clean architecture with riverpod that can be used on big application.
you made a day...thanks for beautiful explanation...
Next. Level. Remi made some good work here, I love it. You explain it very well, needed this.
Wow, 40 minutes about Riverpod 🥳
I needed this sooo badly. Thank you so much!!! So glad I discovered you
Thank you very much for the video. Can we expect the architecture of the app using Riverpod
Very nicely explained! I was waiting for such a good Riverpod tutorial. I hope you will continue with some more deep dives. Thank you!
Gracias por compartir este conocimiento, en este momento voy a implementarlo en un proyecto que estoy desarrollando. Éxitos en todo lo que hagas!!!
Yeah~ Riverpod!!! 🎉🎉 Hope to see more videos about how to implement riverpod in upcoming applications! Thank you Matt!
Nice to see you back with this type of video and written tutorial combo Matt. Excellent arguments and explanations of what benefits Riverpod offers over POP (Plain Old Provider 😀). Looking forward to more in-depth tutorials on Riverpod. 💙
Thanks! I'm stealing that abbreviation from now on lol!
Thought it would go nicely together with PODO and POJO 😀
@@ResoCoder Me too :)
Better than bloc. ? Which one to use? I'm using bloc for last 6 months.
This is what I wait for longgggg time, love you Matt :D
Excellent
Excellent tutorial. Thanks Matt! Riverpod looks like a nice step forward. I'll probably convert once it is released/stable.
One minor note regarding your comments at the beginning about ugly nesting of Providers in the original 'provider' package: 'MultiProvider' already deals with that problem, so your use case is a little unrealistic for that particular comparison.
Thank you very much ! This is great !
Thank you so much for your tutorial.
I like that this solves the look up problem but I'm leaning more towards cubit and freezed. Definitely looking forward to a more comprehensive example.
My main problem with cubit and blocs is the one that Reso mentioned in the beginning: you have to mix dependencies through your UI/presentation layers.
I have worked in 3 production projects and 2 are using provider and blocs (one uses cubit only because it was released recently), and it leaks so much of the dependency, that it is almost impossible to apply dependency inversion and encapsulate views-only responsibilities.
Thank you so much for this tutorial
Oh yes. I always wanted a provider tutorial from you and now I have it :D
Great tutorial Reso, as always.
This is awesome! Would love to see how to use it in a DDD structure
Goodbye provider. Thanks for showing this
Thank , aweasom tutorial, can you use Riverpod in an clean architecture project ? thanks so much
I have the same questions. Has anyone tried?
Great job 👍
Excellent tutorial and explanations, great work!
Hey would you say its worth adapting riverpod over bloc in a new project?
Good explanation. I like this copy-paste code technique more than Fireship's one.
One easy solution using the original provider package is to define subtypes that you can pass to the generic. Same effort as declaring global variables, no? Plus it results in clearer data model. BUT I like that Riverpod removes provider widgets from the tree. 🤓
thank you reso Perfect ,,, i just want to ask you about the color theme that you are using with vs code
u found it?
Awesome content, thanks for sharing ⚡
You're welcome!
Which is better Bloc or Riverpod for state management?
Thank you for sharing.
You can actually use Riverpod to provide BLoCs to your widgets...
You can use StateNotifier which comes bundled with Riverpod. It's very similar to Cubit. A tutorial on that is coming!
@@ResoCoder can't wait 🤗
@@youtornado and ResoCoder, do you still prefer Bloc over ChangeNotifier or StateNotifier?
Great content!!
How dislike this type of video? why?
Thanks for the explanation
Hi Matej! Could you cover the state management/dependency injection called GetX?
i liked it, thanks
Hello and thank you for your tutorial.
I am developer who uses Cubit and am curious how do you think these 2 compare?
It seems, to me, that Cubit/Bloc is better at separating the logic of the app from the UI as is more pattern like: you have a logic class (the cubit) and the state class.
Riverpod seems, again to me, to be all over the place and it entangles with the UI a bit to much.
Awesome. ScopedReader is deprecated. Other stuff is amazing and covers the basics.
I was thinking of learning bloc. Should I skip it and learn riverpod?
I hope you continue to use TDD on all your video tutorials :)
Best tutorial!
Excellent tutorial and hoping the next would be talking about States_rebuilder, it changed a lot since last tutorial.
would have love to see how this would fit into that numbertrivia app or any architecture
Great explanation, many compliments!!! Linear, progressive and very well commented, the best tutorial for the introduction to the great package flutter_riverpod
What theme are you running for VScode? And what extension to get the widget tree bars?
u found it?
Well done.
Thanks for this
What's the best location to put global provider's (dependency injection)? In main, sperated file...
I put them into a file called "providers.dart". If you have just way too many providers and a single file would get out of hand, you can create provider files per feature of the app.
@@ResoCoder So you have to import them in every file that you need them? Is there some example in a git-repo?
great thanks very much
Thank you for these amazing videos and articles. It would be great to learn more about Riverpod in action from you. Btw I would absolutely join if you start a Udemy course. Best Regards,
Amazing! Thanks
you can use injectable annotation processor with getit
Awsome video as always
Thank you! What's the extension giving you the dotted lines to show the nesting?
It's a vscode setting, something to do with guidelines I think
Thanks sir
Game changing
context.read doesn't work with flutter_riverpod 1.0
Thanks for the video, great content. 1 question tho:
Why are you putting a regular provider inside the future provider? Can't we just skip the regular provider and create the http request inside the future provider?
Whats the difference using a simple Provider instead of a global variable? Wouldn't it be the same?
Like:
final constString = 'constant string';
and
final providerString = Provider((ref) => 'provider string');
The latter can be mocked easier, using overrides.
Thanks
Wow.. More on Riverpod
Have you taken a look at GetX?
Please make tutorial Flutter with Modularization, make module is independent.
Thanks
Do riverpod support data streaming?
How do I read futureprovider? I never enter the .when method inside onpressed functions with futureproviders
More riverpod tutorial
What about using bloc with riverpod ?
can riverpod be use in large scalable project ?or we should bloc? Bloc ia too complicated to understand
I use Riverpod in all production-grade apps I build nowadays.
@@ResoCoder does riverpod suits for large scalable project like ecommerce, hospital appointment system?
Hello. I started watching tutorials yesterday. Can I skip learning Provider and jump to Riverpod instead? Is it okay? Thanks
When time for GetX? 🖤😄
Hahahah same
I use GetX as the dependency injection with Bloc. It’s PERFECT. I no longer using any Provider(), need context to get the bloc, and can easily create and delete the Bloc instance from anywhere in the app. GetX can construct Blocs as a singleton too. I gain more power of dependency injection from GetX but still remain the testability from Bloc.
Interesting for sure, but would you mind do some more comparison provider - riverpod? So far it feels really similar... Also for some reason even after the explanation it feels really weird to have bunch of global vars just hanging there instead of putting them inside the widget tree.
can I use Bloc provider with Riverpod?? @resocoder?
Riverpod/Firebase series pls :)
Finally riverpod
Would be GREAT to have a tutorial with Riverpod that consume real Data from an API, just as it is in real life work situation (not firebase aye but Services, Repos, Riverpod, UI)
Do you work with only one dart file? If you work with many dart files, you will have to globally create a provider in every file so you can reference it in the build function? I currently use GetX and this way more comfortable and much easier to use even routing is a breeze. The docs on Riverpod are hard to follow and are all over the place.
please make a easier and digestable beginner tutroial for fluter
Awesome tutorial! I noticed that you're using windows. How do you test your apps for the ios enviroment?
You can’t without a virtual Mac and Xcode installed
How can we achieve something like buildWhen
So is flutter used as much as native android now? I've been doing it for a week now but idk how to store data for android and web like native android has sharedpreferences or room for storing a string.
Perfect 😍😍😍
Bloc vs Riverpod?
32:15 🔥
Riverpod in 40min!!!
download?
I kind of don't understand. So when using riverpod, you're supposed to leave global variables around the codebase? Won't that be worse than provider base?
They are global variables in the same way that classes are global. Instantiated classes (objects) are local to their scope. The same goes for objects provided by Providers.
now we need provider vs riverpod vs bloc video
Riverpod or Bloc?! I'm extremely confused!
You don't have to choose with RiverBloc!
@@RandalLSchwartz Is that another package/library?
@@joaquingumucio2758 Yes.
What‘s the plugin for `=>` called?
Hope you know it now. If you don't, these are called Font Ligatures. They are available in official Jetbrains Mono font, Fire Code font, etc. In Android Studio, it can be enabled under Preferences > Editor > Font.
How to achieve DI using reverpod like getIt.
In the video he had a provider that provided the FakeHttpClient() object. This can be a real http client or anything else that you would want to inject into your app. Using the ref variable on a provider you can access other providers establishing dependencies.
Yo can you send the vscode theme and font please 🙂
u found it?
which app series coming next !!!