Pragmatic State Management Using Provider (The Boring Flutter Development Show, Ep. 24)

  Рет қаралды 70,727

Flutter

Flutter

Күн бұрын

In this episode, Filip and Matt go over the Provider package, a straightforward way to manage state in a Flutter app. Watch the pair swap out BLoC with Provider in the Hacker News Flutter app.
Provider Package → goo.gle/2YnDeVD
Pragmatic State Management in Flutter (Google I/O'19): → goo.gle/2XKlVBb
Watch more episodes of the Boring Show here → goo.gle/Boring...
Get started with Flutter → flutter.dev
Learn more about the Dart Language → goo.gle/2YF9OCi
Try a Flutter codelab → goo.gl/d3fHPo
Join the conversation → goo.gl/68oUnb
Subscribe to the Flutter channel → goo.gle/Flutter
#Flutter #BoringShow #AppDevelopment

Пікірлер: 124
@easyflamer
@easyflamer 5 жыл бұрын
I'd love for there to be another Boring Show with working on provider from scratch
@josecoverlessons
@josecoverlessons 5 жыл бұрын
same
@poongkv123
@poongkv123 4 жыл бұрын
same +1
@bazilangullia6494
@bazilangullia6494 4 жыл бұрын
yup
@michaelappiah-kubi2829
@michaelappiah-kubi2829 3 жыл бұрын
Yeah
@aseemsharma4643
@aseemsharma4643 3 жыл бұрын
Same +1
@WikiPeoples
@WikiPeoples 5 жыл бұрын
I love this show. 1) I am able to learn a lot while watching it. The context you get from watching you guys think about why/when to use a certain technique is really valuable and you don't get that in little snippet videos. 2) It's really reassuring to see you guys actually have to "think" about what to use. In the world of hyper-editted videos, it's easy for someone to come off as having zero struggle or thought process. Seeing you guys take a pause to consider the implementation is a nice reflection of the reality of programming - we're not just typing hundreds of lines of code every minute, flawlessly slamming out the perfect implementation.
@onetdev
@onetdev 5 жыл бұрын
I love to see you guys struggle as much as I do (as a flutter newbie).
@filiphracek
@filiphracek 5 жыл бұрын
Software development is hard (like most things that are worth doing, imho). Glad this show is useful to you! Once you're expert, please don't forget to give back - show the next wave of newbies that even when you're expert, these things can be hard, and that's okay. Cheers!
@vkhooda24
@vkhooda24 4 жыл бұрын
That's exactly what I was looking for where refactor code having bloc pattern to provider pattern. It's really a very nice vblog on state management using provider. Though it names boring flutter development, in actual it was very interesting and I really enjoyed it. There was much learning along with the provider implementation. Thank you Flutter team, of course, Matt and Filip.
@mikeyinger4204
@mikeyinger4204 2 жыл бұрын
This stands the test of time. I laughed out loud a lot, especially in the beginning. Thanks for just wading into it and demonstrating good coding practice during realtime refactoring. I came here because my page keeps getting the MyApp's MaterialApp's context and then can't see the Providers that reside lower in the tree. Anyway, now I'm gonna watch it again.
@Mohamedhassan-if8ww
@Mohamedhassan-if8ww 5 жыл бұрын
the best show ever . better than netflix
@MitchellWongHo
@MitchellWongHo 5 жыл бұрын
Apart from the excellent content, I ❤️ Matt's t-shirt
@tripathiabhay1
@tripathiabhay1 4 жыл бұрын
Having some friendship with RxJs and RxJava, This episode was an interesting one to me among many others. You guys are great. One Request - Please create an another episode on providers for medium to large application from scratch with some detailed info on it.
@michelonwordi3202
@michelonwordi3202 5 жыл бұрын
I need that dart t-shirt Matt's rockin.
@2c7s
@2c7s 5 жыл бұрын
It's not often that I feel so good after watching the notification for a "boring show".
@2c7s
@2c7s 5 жыл бұрын
Once it was for the boring company.
@markusmcgee
@markusmcgee 4 жыл бұрын
Good paired programming. Need more videos like this. Off the cuff and trying to fix things on the fly.
@oliverbytes
@oliverbytes 5 жыл бұрын
Thanks guys!!! Officially switched to provider from scoped_model!! Thanks flutter team
@SreekanthKrishnan
@SreekanthKrishnan 5 жыл бұрын
Thanks for such a boring show 😆. Have been waiting for this topic. Hope you'll continue on this in next episode. I think you guys should try live boring show so that we can also participate.
@rbp365
@rbp365 5 жыл бұрын
that dart side T-shirt is kicking all kinds of asses
@sarusethi987654321
@sarusethi987654321 5 жыл бұрын
Please do a show on State Management again. This was not informative at all. Demonstration of any architecture with an app that has 1-2 screens is easy. But how will the architecture scale in medium to large scale apps. We would love to hear what architecture solutions are used by big apps such as Google Ads, Hamilton, Reflectly etc.
@dangggdennis
@dangggdennis 5 жыл бұрын
I agree that seeing some deep examples would be helpful, but paradigms and architecture that work for large scale apps may often be overkill for small to medium scale apps. But hey, not saying your app isn’t large scale.
@1234zaptor
@1234zaptor 3 жыл бұрын
@@hoodedferret can u provide a link?.
@peterphillip99
@peterphillip99 5 жыл бұрын
Watched your conference guys, and that was great. I used provider on my app. It was simple to implement and made so much sense. Looking forward to watching this one
@sadabwasim9850
@sadabwasim9850 5 жыл бұрын
Best episode so far, loved it
@truongsinhtran-nguyen7129
@truongsinhtran-nguyen7129 5 жыл бұрын
As Matt admitted, this is quite struggling and confusing, possibly because we are refactoring from stream pattern to listener pattern. However, after watching this show, I have an impression that Provider is doing more than one things at the same time (SOLID anyone?), one is dependency injection, and two is dataflow/state management. Doing DI, Provider is better and/or easier than InheritedWidget, at least with proper `dispose`. This is the reason it is said that Provider can be used with BLoC, and creates some confusion. Doing state management, it takes a different approach than BLoC (which is basically stream/reactive/Rx), so the learning curve to flutter can be gentler for those who don't have the background in reactive functional
@putinninovacuna8976
@putinninovacuna8976 5 жыл бұрын
it's not boring but awesome we can learn alot about provider I wish I can code like u all
@martdingley
@martdingley 5 жыл бұрын
Great show guys, full of laughs 😂
@Dhruvam
@Dhruvam 5 жыл бұрын
I am definitely going to try Provider. Bloc has been really hard to implement small features.
@djminikin
@djminikin 5 жыл бұрын
actually, that's quite easy even boring and repetitive when you understand how it works.
@pradeep422
@pradeep422 5 жыл бұрын
Oh My fav Matt heree finally.........:)))) Awesome!!!!!!
@EricBichara
@EricBichara 5 жыл бұрын
Very informative!
@kojoprempeh
@kojoprempeh 5 жыл бұрын
The much awaited show 💃🏽
@websky4241
@websky4241 5 жыл бұрын
Make a movie about the 3.0 provider. There are many changes, for example ProxyProvider, how to use it and when. BTW nice video 😉
@TienHuynh5312
@TienHuynh5312 5 жыл бұрын
Can you update the documentation on use cases of different providers?
@EibeMandel
@EibeMandel 5 жыл бұрын
Could you do In-App Purchases next? It's one of the most important topics.
@soufiane_akki
@soufiane_akki 5 жыл бұрын
kzbin.info/www/bejne/hIjFnH5-YpermbM
@shavar67
@shavar67 5 жыл бұрын
EibeMandel they already did checkout the playlist
@zhorky
@zhorky 5 жыл бұрын
Actually receipt validation is way more important, because if you don't validate your IAPs people will cheat on it.
@mohammadhossieni2636
@mohammadhossieni2636 5 жыл бұрын
visit episode 20 and fireship channel too
@youkokaku
@youkokaku 5 жыл бұрын
Please do an episode on local notification, and how the provider framework works when you try to tap on the notification pop up to open to a specific page. This would be very helpful!
@DanielPorto0
@DanielPorto0 5 жыл бұрын
I started thinking that it was an extended version of the IO talk, but instead of a nice way into Provider it was actually a painful guide of something you advised not to do in the talk: which is porting to Provider an app that was already working perfectly in Bloc. As a result it requires knowledge of both (BLoC and Provider) and was a pain to watch. Don't get me wrong, I love the show and I follow the whole series. But the question that remains in my mind after this process is whether I really learned something or got even more confused... was it worth it? Maybe a better move would be porting from hardcore bloc to flutter_bloc lib instead. And for provider lib, something from scratch would more helpful to 'think provider' from the beginning. Of course, that is either a branch of this show or we will have to wait until a new series start. But thanks anyways. Sincerely.
@basudevnayak8762
@basudevnayak8762 3 жыл бұрын
Seeing Google guys using apple is fun 😂
@lasindunuwanga5292
@lasindunuwanga5292 3 жыл бұрын
Awesome vid. They sitting there for almost an hour. Hard working i guess
@d-apps2699
@d-apps2699 5 жыл бұрын
Thank you for this video but the current version of provider is 3.0.0 but the video is 2.0.1 :(
@willzarem
@willzarem 4 жыл бұрын
Could you guys do an example of how to implement FirebaseCloudMessaging with state management and provider? I'm struggling a bit with it since I want to use the same architecture you're showing. :)
@nidalbakir4720
@nidalbakir4720 4 жыл бұрын
provider now is in version (4.x.x) and hopefully, you make video for this and in a way more forcesing on provider itself ''Sorry for bad English "
@sutechsdev
@sutechsdev 4 жыл бұрын
Hi there! I started Flutter with the provider and I'm pretty comfortable with this. But now my company is asking me to use BloC, but I really don't like BloC, and I'm getting a hard time working with the bloc. So should I use bloc or just say to my company that I can't use bloc. Please suggest should I use bloc or not.
@flutterpiaui5662
@flutterpiaui5662 5 жыл бұрын
uau amazing!!
@a.k.m.saifulislam3891
@a.k.m.saifulislam3891 5 жыл бұрын
I'd like to know which macbook model you're using as a flutter developer and how it's going on so far with you?
@GuilhermeCarvalhoCarneiro
@GuilhermeCarvalhoCarneiro 4 жыл бұрын
Does the information proceed that the Provider should not be used in medium and large projects because of the limitation of ChangeNotifier in relation to the number of listiners that it can answer? Sorry for bad writing, I don't speak English
@michelfeinstein
@michelfeinstein 5 жыл бұрын
Why did you initialized the cache Map() in an initialization list at the constructor, and not at the field's declaration? It doesn't use anything from the constructor.
@mattl7599
@mattl7599 5 жыл бұрын
Matt, where did you get that T-Shirt! Its awesome haha! I want one.
@Michael-ri8sg
@Michael-ri8sg 4 жыл бұрын
me2!
@TheDragonballpokemon
@TheDragonballpokemon 3 жыл бұрын
i have one question What is the overhead of sending a object down the stream so for example i have an application with arround 25 widgets Or arround 12 screens. i set the initial value at screen 3 and get and use the value at screen 10-12 The whole process of passing object from 3 to 10 using context will have some overhead What and how much exactly will be the overhead for moving 3 to 10 without using it once Thanks
@saiprasadchindam5185
@saiprasadchindam5185 2 жыл бұрын
Great video, please share the code
@michelfeinstein
@michelfeinstein 5 жыл бұрын
This Notifier reminds me A LOT an MVVM ViewModel from C#... How do they differ in architecture?
@82invisinle82
@82invisinle82 5 жыл бұрын
Great video about Provider. I have a question in my mind though. I would be happy if you can help me to understand some point. I have an app and I am using provider to handle the authentication. I wrapped my MaterialApp with ChangeNotifierProvider. Apart from that I have an Auth class that extends ChangeNotifier and I notify the listeners after the user is logged in or I check if there is a current user(local storage) in the constructor. Depending on the user state I return appropriate widget(Login screen, main screen etc.) It works perfectly but when I use Navigator to push new routes, The ChangeNotifier builder part where I wrapped MaterialApp rebuilds everytime even there is no change with the data. I am not calling notifyListeners either. So I dont't understand why pushing new routes triggers that part. To give an example I have a widget in the main screen with a FutureBuilder which returns a list. When I click to a list item it pushes to a detail view. When I go back, it rebuilds the previous widget so FutureBuilder is fired again. I assume it is rebuild because it is a descendent of MaterialApp and that part is being rebuild causes my main screen to rebuild too.
@michelfeinstein
@michelfeinstein 5 жыл бұрын
You guys should review the captions, someone captioned "Flutter" as "Photo"
@amanshah2654
@amanshah2654 4 жыл бұрын
i really wanna know which is better this approach or bloc pattern for state mangement
4 жыл бұрын
why you don't advise on checking other patterns like MVP or clean architecture? is it at antipattern somehow to Flutter react world? I'm having some issues with coworkers were they argue that this is now how Flutter should work because you advise Bloc or Provider instead of other's
@thiagoblin
@thiagoblin 5 жыл бұрын
I need that shirt! Where can I find it?
@Michael-ri8sg
@Michael-ri8sg 4 жыл бұрын
me2
@marvinm6156
@marvinm6156 5 жыл бұрын
How does the provider work in situations where i want to use Navigation-Routes? My Provider isn't there available anymore. How do i reach it there?
@marvinm6156
@marvinm6156 5 жыл бұрын
OK i found a way by myself. One way ist to move up the Provider initizaltion above the Material App. More ways can be found here: github.com/rrousselGit/provider/issues/85
@SafdarAliShah_TimeTraveler
@SafdarAliShah_TimeTraveler 5 жыл бұрын
Amazing...Videos..Love it from Pakistan..Peace out..TC #flutter #love_flutter #pakistan #dart #provider
@raul286162
@raul286162 5 жыл бұрын
Well first at all, please use a black theme for your IDE 😅. Now It was a great refactoring example from Bloc to Provider but, since I'm new in flutter and I'm already starting with couple hours with Bloc, there are some things confusing me, can I really completely replace a complex bloc project with Provider. I was wondering how I’ll deal with certain logic like showing modals, snackbar, notifications, etc. Because all the examples that I found are straightforward. Or is provider not intended to solve such things? It’s just a DI system? PD: 1:01:55 Each one of us has been there 😂
@easyflamer
@easyflamer 5 жыл бұрын
I'm actually curious about the same stuff. I kinda have some stuff like triggering snackbars with Provider but I feel like it's very hacky and it'd help a lot to see what idiomatic Dart looks like for that XD
@KsAmJ
@KsAmJ 5 жыл бұрын
I need this dart shirt 😕
@GroovinChip
@GroovinChip 5 жыл бұрын
Matt's Flutter apparel making me jealous as usual lol
@shababkarim5907
@shababkarim5907 4 жыл бұрын
why is it that every time I start a new app, I need to watch this video :(
@TusharOjha
@TusharOjha 4 жыл бұрын
53:59
@LE8271
@LE8271 4 жыл бұрын
Is there ANY advantage of Bloc vs Provider in reality?
@chrisodonnell86
@chrisodonnell86 5 жыл бұрын
Hey with using StreamProvider.value, do you have an example of how to use the the "catchError" property, I can't find anything online besides the official documentation which I can't translate to a real world example. Help! :)
@Trancecend
@Trancecend 5 жыл бұрын
How old is this? Provider 3.0 has been out for a while now.
@hadifromlebanon3812
@hadifromlebanon3812 4 жыл бұрын
When rapping the whole app with a ChangeNotifierProvider, and say for example a specific value that’s being displayed in a text changes, does the whole ui get rebuilt or only that specific textview?
@watchcrap1
@watchcrap1 4 жыл бұрын
No the listeners will be rebuilt. Wrapping the app with ChangeNotifierProvider just allows to you access the provider further down the widget tree, e.g. with the Provider.of(context) or the Consumer().
@MinhTran-xn3kk
@MinhTran-xn3kk 5 жыл бұрын
hi. should i create class called model to put data/vars into it to keep provider is simpler. look like MVP or MVVM ?
@jimjaylee7553
@jimjaylee7553 5 жыл бұрын
That's shortest boring show ever~ Let's bore people further. hahahaha
@MinhTran-xn3kk
@MinhTran-xn3kk 5 жыл бұрын
Why provider's version is 2.0.1 now ?
@MauricioFernandez78
@MauricioFernandez78 5 жыл бұрын
nop 3.0.1
@websky4241
@websky4241 5 жыл бұрын
It need to be 3.0.0 now 🤔
@G4MR1
@G4MR1 5 жыл бұрын
I clicked that link so fast!
@jayvasant114
@jayvasant114 5 жыл бұрын
Where can I find source code to refer after watching the video ?
@pskpsk6
@pskpsk6 5 жыл бұрын
How are errors handled. Like a Network request failed
@guidoc3518
@guidoc3518 4 жыл бұрын
it only works on debug mode, on release it doesn't work unless you kill the app and reopen.
@andreya1087
@andreya1087 5 жыл бұрын
link to the pull request github.com/filiph/hn_app/pull/7
@sweetogo
@sweetogo 4 жыл бұрын
So, for state management, is it a Flutter best/preferred practice to use, especially in a new app, provider instead of BLoC? I see even Flutter documentation documents provider for simple state management: flutter.dev/docs/development/data-and-backend/state-mgmt/simple
@RenittoJose
@RenittoJose 4 жыл бұрын
stackoverflow.com/questions/57559489/flutter-provider-in-initstate Same issue but I need to pass 2 parameters from the widget to the method in Provider. Couldn't find a proper answer yet. Any help is appreciated.
@kamaleshbasu3755
@kamaleshbasu3755 4 жыл бұрын
While Provider is good for smaller apps, I constantly find that it gets cumbersome when working with multiple developers and for really large Apps. Redux is definitely the way to go for such Apps.
@xiaojiangguo1596
@xiaojiangguo1596 5 жыл бұрын
mark
@ITMANZ
@ITMANZ 5 жыл бұрын
Hi max :)
@m.arslankhan7449
@m.arslankhan7449 4 жыл бұрын
can anybody explain please @25:02 when the context is replacing with the underscore . why ?
@hadifromlebanon3812
@hadifromlebanon3812 4 жыл бұрын
M.Arslan Khan nothing important, usually unused parameters like in this case get named as _ as a convention
@arqamhussain8298
@arqamhussain8298 3 жыл бұрын
Wait a minute ! they are using macbooks !
@jasonleo
@jasonleo 5 жыл бұрын
what exactly is BLoC stand for
@wongni
@wongni 5 жыл бұрын
Business Logic Component
@jasonleo
@jasonleo 5 жыл бұрын
@@wongni thank you!
@MyDisal
@MyDisal 4 жыл бұрын
can you please go dark mode?
@prafulgupta7004
@prafulgupta7004 5 жыл бұрын
Have a look at state_rebuilder
@michelfeinstein
@michelfeinstein 5 жыл бұрын
Guys, I love the show, but I honestly think it could be a lot better if you had some preparations beforehand. This way you could show us all the struggles that you had, but just taking a small amount of time, while coding the best solution at the show.... Instead of just trying to make things work in one hour, and not showing us the proper way to solve things. I don't mean to be harsh, I just think the show could be better, more informative this way :)
@zhenliu287
@zhenliu287 5 жыл бұрын
Why no Chinese subtitles?
@MinhTran-xn3kk
@MinhTran-xn3kk 5 жыл бұрын
39:10 why ids is final . i usually use var :(
@suzukiaki6066
@suzukiaki6066 5 жыл бұрын
Because there're no reassignment of that variable. Using final makes code easier to understand and it tells the next reader that the value is from only this assignment not from elsewhere. Basically if you keep functions small, variables is not gonna be assigned multiple times.
@bacharsaleh6984
@bacharsaleh6984 5 жыл бұрын
Old record. Provider version now is 3. 😁
@raul286162
@raul286162 5 жыл бұрын
That was quick xD
@sahilkumar2953
@sahilkumar2953 5 жыл бұрын
This looks more or less like scopedModel to me
@themri
@themri 5 жыл бұрын
The most confused boring show
@filiphracek
@filiphracek 5 жыл бұрын
That's my secret Cap. I'm always confused.
@ramonblack
@ramonblack 3 жыл бұрын
tutorial on how to program without google haha
@tuobraun
@tuobraun 5 жыл бұрын
Oh, I wish I could understand something :’( I guess I need to start from scratch again...
@rikyriky966
@rikyriky966 5 жыл бұрын
Sorry but this video provides nothing beneficial to me. Why don’t you guys go with somewhat the basics?
@mukhtarfauzi5824
@mukhtarfauzi5824 5 жыл бұрын
koplak 😁
@praharshbhatt2934
@praharshbhatt2934 5 жыл бұрын
first
@RaphaelPungin
@RaphaelPungin 3 жыл бұрын
Too much talking about unrelated stuff. Please stick to the topic and this will make the video shorter. We need to spend time coding our own apps rather than watching one-hour videos. Thanks!
@poindexterfrink8276
@poindexterfrink8276 5 жыл бұрын
To those looking to quickly learn and implement clean state management in flutter, skip learning this whole layer and check out flutter_redux.
@gofudgeyourselves9024
@gofudgeyourselves9024 5 жыл бұрын
Last
إخفاء الطعام سرًا تحت الطاولة للتناول لاحقًا 😏🍽️
00:28
حرف إبداعية للمنزل في 5 دقائق
Рет қаралды 49 МЛН
когда не обедаешь в школе // EVA mash
00:51
EVA mash
Рет қаралды 3,9 МЛН
Pragmatic State Management in Flutter (Google I/O'19)
33:25
Flutter
Рет қаралды 452 М.
Riverpod Simplified | Easy State Management
14:17
Tadas Petra
Рет қаралды 44 М.
Teeth Aren't Supposed to Do This
8:30
Daily Dose Of Internet
Рет қаралды 2,8 МЛН
Flutter State Management - The Grand Tour
14:07
Fireship
Рет қаралды 242 М.
Flutter Provider EASY Tutorial
9:43
Flutter Mapp
Рет қаралды 53 М.
DashCast is back! (The Boring Flutter Development Show, Ep. 32)
1:02:28
إخفاء الطعام سرًا تحت الطاولة للتناول لاحقًا 😏🍽️
00:28
حرف إبداعية للمنزل في 5 دقائق
Рет қаралды 49 МЛН