Flutter State Management with Riverpod: The Essential Guide

  Рет қаралды 26,752

Andrea Bizzotto

Andrea Bizzotto

Күн бұрын

A complete guide to the Riverpod package for Flutter state management. Included: core concepts & how to use all the available providers.
Written tutorial here: 👇👇
codewithandrea.com/videos/flu...
Flutter Movie App with Provider, Riverpod & flutter_bloc: 👇👇
github.com/bizz84/movie_app_s...
CONTENTS:
00:00 - Intro
00:58 - Why Riverpod
02:37 - Riverpod Installation
03:29 - ProviderScope
03:49 - Creating the first Provider
05:31 - StateProvider
06:54 - ProviderListener
07:52 - StateNotifier
09:18 - StateNotifierProvider
10:54 - ChangeNotifierProvider
11:31 - FutureProvider & StreamProvider
13:00 - AsyncValue
13:47 - autoDispose
14:57 - family
17:21 - Dependency overrides
18:39 - Combining Providers
20:04 - ScopedProvider
22:00 - When to use watch vs read
23:29 - Testing
24:28 - Mock and override dependencies in tests
25:50 - ProviderObserver
27:42 - Wrap Up
Join my FREE email course to become a Flutter expert with the best resources, at your own pace: codewithandrea.com/newsletter/
Want more? Check out all my Flutter courses: 👇👇
codewithandrea.com/courses/
Happy coding!

Пікірлер: 62
@andenetalexander5244
@andenetalexander5244 3 жыл бұрын
By far the best riverpod tutorial Andrea you're the best!
@whitemagehealing8126
@whitemagehealing8126 2 жыл бұрын
This is great! Thank you so much for explaining WHY riverpod was made (i.e. showing a real example of the drawbacks with a diagram) It helps a lot in design decision-making!
@tameflame1229
@tameflame1229 3 жыл бұрын
Amazing job with this video, a great summary of riverpod, I've been using it for a while now and this is a great refresher on the more advanced stuff
@hectorprx
@hectorprx 3 жыл бұрын
Very well done, the written tutorials really bring it all together. Thanks and all the best
@vickybhavnagri
@vickybhavnagri 3 жыл бұрын
Thank you so much Andrea. Was eagerly waiting for this tutorial. As always, in-depth, and very production ready. :)
@socketam4524
@socketam4524 3 жыл бұрын
Really like this format of tutorials! Thank you!
@ardeshirojan1468
@ardeshirojan1468 Жыл бұрын
by faaar the best Riverpod Tutorial
@rydmike
@rydmike 3 жыл бұрын
A Very complete run-through of Riverpod. Excellent tutorial, my new go to reference for looking up any Riverpod use case scenario. Outstanding job Andrea! 💙 To others watching, ChangeNotifierProvider is skipped a bit, and indeed do prefer and use StateNotifierProvider instead. However, ChangeNotifierProvider is great if you are converting a Provider app to Riverpod and have used it there. You can then start with it, your model classes then remains unchanged and later you can convert them to StateNotifierProvider, if you find it beneficial.
@bjoerndotsol
@bjoerndotsol 3 жыл бұрын
Very good! Esp. the hints when to use something are great. It really fills the gaps :)
@furkanvatandas4819
@furkanvatandas4819 3 жыл бұрын
That is a very useful guide for researching Riverpod after BLoC.
@whorudra
@whorudra 3 жыл бұрын
Thanks Furkan. I showed your post on discord and came here directly.
@realmex6690
@realmex6690 Жыл бұрын
Thanks for sharing your wonderful knowledge. It's really worth appreciating 👏
@abdulwahabkhan4316
@abdulwahabkhan4316 Жыл бұрын
Great .... That was very well explanation in very shot time... 👍👍👍
@ajaykotiyal427
@ajaykotiyal427 2 жыл бұрын
So Good Explaination.
@kenmmita346
@kenmmita346 3 жыл бұрын
Great tutorial
@RandalLSchwartz
@RandalLSchwartz 3 жыл бұрын
Excellent!
@homamis639
@homamis639 2 жыл бұрын
Thank you!
@ezone2726
@ezone2726 3 жыл бұрын
Awesome tutorial👌👌 If possible please make a tutorial of some widgets like switch,snackbar, popup menu,textfield, alert dialog slider as to manage the state management through flutter_riverpod. #thankyou #flutter #happycoding
@7mada89
@7mada89 3 жыл бұрын
Hi Andrea good to have you back. I have a stupid question 😅 If I use ScopedProvider redundancy for every widget I have (by map or object) to make all my widgets constant would this be good or bad.
@delmanali4863
@delmanali4863 2 жыл бұрын
Plz do more totrial with Riverpod firebase stateNotifier thanks
@nadeeshkarunarathna1836
@nadeeshkarunarathna1836 3 жыл бұрын
super
@djanogly
@djanogly 3 жыл бұрын
GOAT
@RandalLSchwartz
@RandalLSchwartz 3 жыл бұрын
At 17:16, should note that the custom data class needs a deep-equals, not an object-identity equals. Same with the Map... needs to be immutable.
@necipakgz
@necipakgz 3 жыл бұрын
I hope you do a getx tutorial like this, many of us waiting for that :)
@agung_laksana
@agung_laksana 3 жыл бұрын
Andrea, please make a complete course using riverpod 😄
@CodeWithAndrea
@CodeWithAndrea 3 жыл бұрын
My upcoming animations course will use Riverpod nnbd.me/fa
@waelhi8938
@waelhi8938 3 жыл бұрын
Great in depth tutorial as always! Thank you! Btw, while following your video i encounter some error on LATE keyword. its says : 'unexpected text late, try removing the text.' but when I remove the LATE keyword, it shows a lot of errors. I just copied the code in your written tutorial.
@gustavopavezgikis8604
@gustavopavezgikis8604 3 жыл бұрын
Thats because late is part of null safety. You probably have a version of flutter (prior to 2.x) where null safety is part of the code and allows to use late. Late is to avoid null pointer exceptions. So most likely if you have the issue is because you need instead of using late, to initialize the value of the variable which was previously using the late keyword. Investigate whats late in null safety and you will understand the issue. The easier solution is just to update dart to where late is available.
@tell_me_what
@tell_me_what 3 жыл бұрын
Hi Andrea, I watched your video and it was very instructive. Thanks for your work. By the way my feeling, having worked in production projects with GetX state management, is that GetX is always one step ahead of any other state management. What do you think about that? Have you ever tried it?
@CodeWithAndrea
@CodeWithAndrea 3 жыл бұрын
Various people in the Flutter community have not been positive about the attitude and conduct of the package maintainers. Personally I haven't used it and not planning to.
@leoingson
@leoingson 3 жыл бұрын
@@CodeWithAndrea Thanks for that information. I always wondered, why there are not many instructional videos on getx in the community.
@stefandv23
@stefandv23 3 жыл бұрын
@@CodeWithAndrea this is a bit old news. One year ago there was an issue. One year later people still are talking about it. Too bad.
@pranthonyaquino
@pranthonyaquino 3 жыл бұрын
Sadly true, Stefan, getx is amazing.
@jimaustin3608
@jimaustin3608 3 жыл бұрын
The streamAsyncValue axample (inMyHomePage3) shows only the last value on the screen; I assume the rest go by too fast to see. How can I 'catch' and display the entire stream?
@zhangkevin8147
@zhangkevin8147 6 ай бұрын
I have a question about riverpod. I am in home screen and I click button jump to login screen after login success then I back to home screen and get unread message count how can I do. Thanks!
@whorudra
@whorudra 3 жыл бұрын
Now I can say I understand Riverpod. still have some more doubt like , I am from React background I use prefer using funcitonal component, hooks and context api. So in context api provider we can assign provider value some object in one provider so that it can have values in object. So how do I get this behaviour in Riverpod?(I know it has riverpod_hooks)
@faisalmushtaq2287
@faisalmushtaq2287 3 жыл бұрын
when i try to read some data from FutureProvider and place it inside a stateprovider i get error something like "INSTANCE of ERROR!". i researched alot but invain. Could u help me?
@joegoodman4358
@joegoodman4358 3 жыл бұрын
Excellent tutorial Andrea! however in my code, the onChange callback on the ProviderListener example isn't working. Could you please help me?
@joegoodman4358
@joegoodman4358 3 жыл бұрын
Nevermind, it was something stupid xD
@coderoykid
@coderoykid 3 жыл бұрын
Are you using the auto-type or HackerTyper VS Code extensions to type?
@quicksketch1617
@quicksketch1617 3 жыл бұрын
Hi, do you have this MovieApp tutorial with riverpod? I think it's a good example to understand riverpod.
@CodeWithAndrea
@CodeWithAndrea 3 жыл бұрын
Link to the GitHub project in the article
@fahmisbas
@fahmisbas 8 ай бұрын
is that really performant to use ProviderScope for each item?
@MohamedDernoun
@MohamedDernoun 3 жыл бұрын
After introducing the web to stable, I think we no longer need an emulator that kill the RAM :D
@MrRiyality
@MrRiyality 3 жыл бұрын
Can we get an essential guide for GetX ?
@RioM8z
@RioM8z 3 жыл бұрын
Is Riverpod better then GetX ? GetX is maybe too simple ??
@RandalLSchwartz
@RandalLSchwartz 3 жыл бұрын
That's a religious issue. But I certainly prefer RiverPod.... it just makes everything easy and straightforward, but leaves a lot of room for flexibility. Remi hit a home run on this.
@AliMuhammadAli
@AliMuhammadAli 3 жыл бұрын
this format of videos is not beginners friendly. it assumes that the viewer is already familiar with the subject and he is only looking for the new changes
@theophileo
@theophileo 3 жыл бұрын
not everything is beginners friendly tbh i don't see the point of your comment ...
@erlend1587
@erlend1587 3 жыл бұрын
Nice guide. Have you tried Binder (github.com/letsar/binder) ? A more minimal state handling package inspired by Riverpod.
@CodeWithAndrea
@CodeWithAndrea 3 жыл бұрын
Thanks for sharing. So many packages! I'll take a look :)
@sharukhrahman7925
@sharukhrahman7925 3 жыл бұрын
1. Bloc vs riverpod and when and where to use. 2.How r u getting error on the side while typing?😂
@CodeWithAndrea
@CodeWithAndrea 3 жыл бұрын
1. Honestly, they are both great state management solutions that will work for simple and complex apps. Choose whichever you prefer. 2. Error lens extension
@sharukhrahman7925
@sharukhrahman7925 3 жыл бұрын
@@CodeWithAndrea thanks for providing the Best content btw!👍
@banglafactsteller6780
@banglafactsteller6780 3 жыл бұрын
what is 'late ' keyword!!!!!!!!!!
@CodeWithAndrea
@CodeWithAndrea 3 жыл бұрын
This should help: kzbin.info/www/bejne/l4vXm5aYqMmqitE
@banglafactsteller6780
@banglafactsteller6780 3 жыл бұрын
@@CodeWithAndrea thanks
@pradeep422
@pradeep422 3 жыл бұрын
is it weird, I still like Provider than this lol????
@pradeep422
@pradeep422 3 жыл бұрын
kk i will take it bak hehe...
Starter Architecture for Flutter & Firebase Apps
19:41
Andrea Bizzotto
Рет қаралды 40 М.
Riverpod 2.0 - Complete Guide (Flutter Tutorial)
1:03:37
Reso Coder
Рет қаралды 109 М.
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 112 МЛН
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 17 МЛН
Flutter State Management - The Grand Tour
14:07
Fireship
Рет қаралды 239 М.
State Management Like A Pro - Flutter Riverpod
10:30
Robert Brunhage
Рет қаралды 76 М.
Observable Flutter: Building with Stacked
1:47:30
Flutter
Рет қаралды 22 М.
Pragmatic State Management in Flutter (Google I/O'19)
33:25
Flutter
Рет қаралды 448 М.
Riverpod Simplified | Easy State Management
14:17
Tadas Petra
Рет қаралды 43 М.
Understanding State Management in Flutter - Foundation
13:47
Flutter Explained
Рет қаралды 24 М.
Top 16 Dart Tips and Tricks Every Flutter Developer Should Know
11:44
Andrea Bizzotto
Рет қаралды 59 М.
GetX vs Riverpod | Which is better with Flutter❓
16:20
Riverpod StateNotifier Explained Like a Pro
23:16
dbestech
Рет қаралды 3,8 М.
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 484 М.
КРУТОЙ ТЕЛЕФОН
0:16
KINO KAIF
Рет қаралды 6 МЛН
Rate This Smartphone Cooler Set-up ⭐
0:10
Shakeuptech
Рет қаралды 6 МЛН
Опасность фирменной зарядки Apple
0:57
SuperCrastan
Рет қаралды 11 МЛН