Тёмный

Flutter Riverpod Tutorial - The Better Provider 

Reso Coder
Подписаться 113 тыс.
Просмотров 85 тыс.
50% 1

📗 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

Опубликовано:

 

2 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 145   
@MatuellaSlipknot
@MatuellaSlipknot 3 года назад
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!
@ianjaspersantos8915
@ianjaspersantos8915 3 года назад
Time for riverpod playlist!!!
@hengideguru
@hengideguru 3 года назад
You're the best!! Looking forward for a TDD + CleanArchitecture + Riverpod series!!!
@mahadylol
@mahadylol 3 года назад
Need tutorial on clean architecture with riverpod that can be used on big application.
@puhgeh
@puhgeh 3 года назад
damn! this riverpod is cleaner to implement than provider! time to refactor my project. thank you!
@stephio76
@stephio76 3 года назад
Very nicely explained! I was waiting for such a good Riverpod tutorial. I hope you will continue with some more deep dives. Thank you!
@truth722
@truth722 3 года назад
Yeah~ Riverpod!!! 🎉🎉 Hope to see more videos about how to implement riverpod in upcoming applications! Thank you Matt!
@cptsakamoto
@cptsakamoto 3 года назад
Thank you very much for the video. Can we expect the architecture of the app using Riverpod
@mibi2007
@mibi2007 3 года назад
This is what I wait for longgggg time, love you Matt :D
@richardharris9708
@richardharris9708 2 года назад
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.
@AiEnthusiast999
@AiEnthusiast999 3 года назад
GetX is easier
@thebeststuff5522
@thebeststuff5522 3 года назад
Better than bloc. ? Which one to use? I'm using bloc for last 6 months.
@SamSam-rg4lk
@SamSam-rg4lk 2 года назад
context.read doesn't work with flutter_riverpod 1.0
@Saketjsaket
@Saketjsaket 3 года назад
Thank you so much for your tutorial.
@rydmike
@rydmike 3 года назад
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. 💙
@ResoCoder
@ResoCoder 3 года назад
Thanks! I'm stealing that abbreviation from now on lol!
@rydmike
@rydmike 3 года назад
Thought it would go nicely together with PODO and POJO 😀
@mallikarjunreddy5229
@mallikarjunreddy5229 3 года назад
@@ResoCoder Me too :)
@oliverfunk
@oliverfunk 3 года назад
Great tutorial Reso, as always.
@gwapster13
@gwapster13 3 года назад
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. 🤓
@adianblabla
@adianblabla 3 года назад
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.
@mercatellineto
@mercatellineto 3 года назад
Best tutorial!
@robsonsilv4.
@robsonsilv4. 3 года назад
What's the best location to put global provider's (dependency injection)? In main, sperated file...
@ResoCoder
@ResoCoder 3 года назад
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.
@TheBadFred
@TheBadFred 3 года назад
@@ResoCoder So you have to import them in every file that you need them? Is there some example in a git-repo?
@lincolnzhou9611
@lincolnzhou9611 3 года назад
Great job 👍
@irontildeath
@irontildeath 2 года назад
What theme are you running for VScode? And what extension to get the widget tree bars?
@Malaq4822
@Malaq4822 2 года назад
u found it?
@aadarshainfo3535
@aadarshainfo3535 3 года назад
I was thinking of learning bloc. Should I skip it and learn riverpod?
@aravindc6946
@aravindc6946 3 года назад
Great content!!
@h3w45
@h3w45 3 года назад
Well done.
@holofox66
@holofox66 3 года назад
I still cannot come to terms with global variables in the project (I think this is bad practice). The provider also showed itself from a bad side, in any case, I would not recommend using such things in large projects. I have not met moments when it would be impossible to do without a provider. For those using flutter_bloc, you don't need any additional providers (and since version 7.0.0-dev.1, the author has abandoned the `package:provider` dependency).
@ResoCoder
@ResoCoder 3 года назад
If Provider is a global variable, then classes are global variables as well... Only the blueprint of how to create the provider is global, just like it is with regular classes where only the blueprint of how the instantiated object will look like is accessible globally.
@prexx8953
@prexx8953 3 года назад
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');
@RandalLSchwartz
@RandalLSchwartz 3 года назад
The latter can be mocked easier, using overrides.
@robsonsilv4.
@robsonsilv4. 3 года назад
Wow, 40 minutes about Riverpod 🥳
@Nobody-ky7sl
@Nobody-ky7sl 3 года назад
Finally riverpod
@regis2480
@regis2480 3 года назад
Hi Matej! Could you cover the state management/dependency injection called GetX?
@mateenmehmood5675
@mateenmehmood5675 2 года назад
Awesome. ScopedReader is deprecated. Other stuff is amazing and covers the basics.
@bumble2685
@bumble2685 3 года назад
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?
@mohamadosama9797
@mohamadosama9797 3 года назад
thank you reso Perfect ,,, i just want to ask you about the color theme that you are using with vs code
@Malaq4822
@Malaq4822 2 года назад
u found it?
@himesh_89
@himesh_89 3 года назад
Thanks
@yazidkrayem7408
@yazidkrayem7408 3 года назад
Which is better Bloc or Riverpod for state management? Thank you for sharing.
@youtornado
@youtornado 3 года назад
You can actually use Riverpod to provide BLoCs to your widgets...
@ResoCoder
@ResoCoder 3 года назад
You can use StateNotifier which comes bundled with Riverpod. It's very similar to Cubit. A tutorial on that is coming!
@AdamSmaka
@AdamSmaka 3 года назад
@@ResoCoder can't wait 🤗
@bobthebuilder6715
@bobthebuilder6715 3 года назад
@@youtornado and ResoCoder, do you still prefer Bloc over ChangeNotifier or StateNotifier?
@acornerofherheart-jr9pl
@acornerofherheart-jr9pl Месяц назад
best explanation I have found on this topic on youtube.....thanks
@2yaya123
@2yaya123 3 года назад
Hey would you say its worth adapting riverpod over bloc in a new project?
@athinavandame
@athinavandame 3 года назад
I needed this sooo badly. Thank you so much!!! So glad I discovered you
@enafor99
@enafor99 3 года назад
Thank , aweasom tutorial, can you use Riverpod in an clean architecture project ? thanks so much
@andrecytryn3745
@andrecytryn3745 3 года назад
I have the same questions. Has anyone tried?
@jeremaine
@jeremaine 3 года назад
Riverpod/Firebase series pls :)
@wisnuwiry
@wisnuwiry 3 года назад
Please make tutorial Flutter with Modularization, make module is independent. Thanks
@longtimedeveloper6498
@longtimedeveloper6498 3 года назад
Fantastic teaching on Riverpod, thank you very much!
@JETLAI123
@JETLAI123 3 года назад
Excellent tutorial and hoping the next would be talking about States_rebuilder, it changed a lot since last tutorial.
@burakbirer5938
@burakbirer5938 3 года назад
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,
@janek727
@janek727 3 года назад
When time for GetX? 🖤😄
@hassanosama357
@hassanosama357 3 года назад
Hahahah same
@poomchantarapornrat5685
@poomchantarapornrat5685 3 года назад
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.
@daviidon
@daviidon 3 года назад
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.
@MatuellaSlipknot
@MatuellaSlipknot 3 года назад
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.
@joaquingumucio2758
@joaquingumucio2758 3 года назад
Riverpod or Bloc?! I'm extremely confused!
@RandalLSchwartz
@RandalLSchwartz 3 года назад
You don't have to choose with RiverBloc!
@joaquingumucio2758
@joaquingumucio2758 3 года назад
@@RandalLSchwartz Is that another package/library?
@RandalLSchwartz
@RandalLSchwartz 3 года назад
@@joaquingumucio2758 Yes.
@vanvicka1
@vanvicka1 3 года назад
would have love to see how this would fit into that numbertrivia app or any architecture
@MohamedDernoun
@MohamedDernoun 3 года назад
I hope you continue to use TDD on all your video tutorials :)
@akshay6019
@akshay6019 3 года назад
More riverpod tutorial
@AkshayBhange
@AkshayBhange 3 года назад
now we need provider vs riverpod vs bloc video
@marekchojecki4746
@marekchojecki4746 3 года назад
Awsome video as always
@FurqanaFathuzzaman
@FurqanaFathuzzaman 3 года назад
This is awesome! Would love to see how to use it in a DDD structure
@jimaustin3608
@jimaustin3608 3 года назад
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.
@paulojamero9670
@paulojamero9670 3 года назад
Hello. I started watching tutorials yesterday. Can I skip learning Provider and jump to Riverpod instead? Is it okay? Thanks
@ITPROFESSIONAL
@ITPROFESSIONAL 2 года назад
i liked it, thanks
@saiseshnagpithani4448
@saiseshnagpithani4448 2 года назад
This Tutorial is outdated.
@lukassimon8324
@lukassimon8324 3 года назад
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.
@highlightstime2723
@highlightstime2723 3 года назад
How do I read futureprovider? I never enter the .when method inside onpressed functions with futureproviders
@stefanomilani
@stefanomilani 3 года назад
Great explanation, many compliments!!! Linear, progressive and very well commented, the best tutorial for the introduction to the great package flutter_riverpod
@arifmaul1690
@arifmaul1690 3 года назад
sir.. could you give us example provider that call http in seperates class file to create ideal structure files flutter with riverpod to provide the api we can use from dummy api like this : dummyapi.io/documentation/static-data-api please sir please..
@TimKariuki
@TimKariuki 2 года назад
Riverpod in 40min!!!
@joaomaia9140
@joaomaia9140 3 года назад
Bloc vs Riverpod?
@AneudysAmparo
@AneudysAmparo 3 года назад
How dislike this type of video? why? Thanks for the explanation
@flutterdev8703
@flutterdev8703 3 года назад
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)
@TechWithDnes
@TechWithDnes 3 года назад
Wow.. More on Riverpod
@carlswanson6746
@carlswanson6746 3 года назад
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.
@samuelcatlow
@samuelcatlow 3 года назад
haha " you've probably seen by now countless f*censored* times". 😂
@wesleybarnes5376
@wesleybarnes5376 3 года назад
Next. Level. Remi made some good work here, I love it. You explain it very well, needed this.
@rsocial453
@rsocial453 2 года назад
This is the best tutorial for riverpod on RU-vid. Thank you
@randomusername982374
@randomusername982374 3 года назад
Goodbye provider. Thanks for showing this
@IngPedroAraujo
@IngPedroAraujo 2 года назад
Gracias por compartir este conocimiento, en este momento voy a implementarlo en un proyecto que estoy desarrollando. Éxitos en todo lo que hagas!!!
@vaibhavdangayachvd
@vaibhavdangayachvd 3 года назад
How can we achieve something like buildWhen
@gligoratanasovski3329
@gligoratanasovski3329 3 года назад
Good explanation. I like this copy-paste code technique more than Fireship's one.
@musliminontong2918
@musliminontong2918 3 года назад
can I use Bloc provider with Riverpod?? @resocoder?
@santoshkawale21
@santoshkawale21 3 года назад
you made a day...thanks for beautiful explanation...
@TheBadFred
@TheBadFred 3 года назад
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.
@cedvdb6473
@cedvdb6473 3 года назад
What about using bloc with riverpod ?
@faheemahmadofficial7701
@faheemahmadofficial7701 3 года назад
please make a easier and digestable beginner tutroial for fluter
@trungledang5225
@trungledang5225 3 года назад
Thanks sir
@mehulbisht9708
@mehulbisht9708 3 года назад
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.
@BrendansReasons
@BrendansReasons 3 года назад
32:15 🔥
@easazade
@easazade 3 года назад
you can use injectable annotation processor with getit
@technoinfoworldwide2329
@technoinfoworldwide2329 3 года назад
can riverpod be use in large scalable project ?or we should bloc? Bloc ia too complicated to understand
@ResoCoder
@ResoCoder 3 года назад
I use Riverpod in all production-grade apps I build nowadays.
@technoinfoworldwide2329
@technoinfoworldwide2329 3 года назад
@@ResoCoder does riverpod suits for large scalable project like ecommerce, hospital appointment system?
@mohamedayad8208
@mohamedayad8208 3 года назад
Excellent
@SlumDawgSaint
@SlumDawgSaint 3 года назад
download?
3 года назад
Awesome content, thanks for sharing ⚡
@ResoCoder
@ResoCoder 3 года назад
You're welcome!
@albanr8028
@albanr8028 3 года назад
Thank you very much ! This is great !
@GroovinChip
@GroovinChip 3 года назад
Excellent tutorial and explanations, great work!
@JJ-rn9zl
@JJ-rn9zl 3 года назад
Do riverpod support data streaming?
@Michael-rc5ks
@Michael-rc5ks 3 года назад
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?
@ResoCoder
@ResoCoder 3 года назад
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.
@oswaldoalvarez9290
@oswaldoalvarez9290 3 года назад
Awesome tutorial! I noticed that you're using windows. How do you test your apps for the ios enviroment?
@TheFlyingMonkey200
@TheFlyingMonkey200 3 года назад
You can’t without a virtual Mac and Xcode installed
@abraiyan7984
@abraiyan7984 3 года назад
Oh yes. I always wanted a provider tutorial from you and now I have it :D
@LeCrowTV
@LeCrowTV 3 года назад
Thank you so much for this tutorial
@freewolf4290
@freewolf4290 3 года назад
great thanks very much
@abegehr
@abegehr 3 года назад
What‘s the plugin for `=>` called?
@rupinderjeetsinghhans
@rupinderjeetsinghhans 2 года назад
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.
@jaimepremy
@jaimepremy 3 года назад
Have you taken a look at GetX?
@banglafactsteller6780
@banglafactsteller6780 3 года назад
which app series coming next !!!
@glowiever
@glowiever 2 года назад
nowadays they're getting harder to distinguish though
@BrendansReasons
@BrendansReasons 3 года назад
Thank you! What's the extension giving you the dotted lines to show the nesting?
@odunayoojomo340
@odunayoojomo340 2 года назад
It's a vscode setting, something to do with guidelines I think