Pragmatic State Management in Flutter (Google I/O'19)

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • Declarative UI frameworks eliminate whole classes of bugs. But they can also be a puzzle until you figure out how to structure your app logic around them. Walk through Flutter's app with live data and see how to structure content in a simple yet scalable way. You'll come out understanding the main approaches of state management in declarative frameworks and have a concrete applicable solution.
    Watch more #io19 here:
    Flutter at Google I/O 2019 Playlist → goo.gle/2ZTbnOs
    Google I/O 2019 All Sessions Playlist → goo.gle/io19allsessions
    Learn more on the I/O Website → google.com/io
    Subscribe to the Flutter Channel → goo.gle/Flutter
    Get started at → flutter.dev/
    Speaker(s): Filip Hracek and Matt Sullivan
    T0CEDC event: Google I/O 2019; re_ty: Publish;

Komentáře • 250

  • @LethiuxX
    @LethiuxX Před 4 lety +3

    I'm so happy that you guys decide to keep talking about state at these conferences.

  • @HezOmanjo
    @HezOmanjo Před 3 lety +13

    Believe it or not this video was my first interaction with flutter when I began my journey in May 2020. It was unbelievably complex but I'm glad I dint give up. I've been a fan of Filip ever since.

  • @brendanlovelife
    @brendanlovelife Před 5 lety +11

    19:40 I just love how the attitude given towards community packages 😊

  • @kenn850
    @kenn850 Před 5 lety +26

    By far the best flutter talk i have seen.
    funny, weigh's alternative methodologies and very educative.

  • @humansofcrypto9746
    @humansofcrypto9746 Před 4 lety +44

    Love their style of delivery, makes the video very enjoyable along with being informative

  • @kenthinson2980
    @kenthinson2980 Před 5 lety +4

    Great talk. As someone who is very used to MVC from iOS I was confused where to start with flutter. This is a great way to start.

  • @cagrigoktas
    @cagrigoktas Před 5 lety +301

    Don't be sad Matt. I wear the same pajamas while watching you last year.

  • @durveshnaik1562
    @durveshnaik1562 Před 5 lety

    One of the best talks. Fun, technical, and cool

  • @codesxt
    @codesxt Před 5 lety +30

    I've been suffering for days trying to implement a feature in a personal project and I just finished implementing the hardest part of it thanks to this talk and the Provider implementation. Life is good. Thank you, guys!

    • @johnmw170
      @johnmw170 Před 2 lety

      Hello am John from Uganda East Africa. I have an app idea but i couldn't afford to pay engineers for building it so I started learning programming. But I can't figer out how to store and use the input data form user please help me how do I do it.

    • @elisiosa3111
      @elisiosa3111 Před rokem

      @@johnmw170 have you figured it out how to store user data? I would like to know how to

    • @valeriygolyshev
      @valeriygolyshev Před rokem

      @@elisiosa3111 if you need to store data locally on user's device, think about shared_preferences package or some databases (see sqflite package for example)

  • @globalplaylist6535
    @globalplaylist6535 Před 5 lety +17

    More than a year working with flutter and dart, from those early days to these Glorious times i just saw one thing and that was the absolute art.
    Thinking about development teams and their unbelievable talent and work is mind blowing...
    I believe we shouldn’t call them programmers or developers, in fact they are artists. I think we need to change our perspective of what the art is.

  • @TarekEZaki
    @TarekEZaki Před 5 lety +24

    This provider sound much easier than bloc. Would love to see more detailed tutorials.

  • @adedokunrokeeb7406
    @adedokunrokeeb7406 Před 2 lety

    i watched this piece and really love it.. the delivery and explanation of the concept was top notch. this will definately help and aid my journey of becoming a flutter developer. thank you google

  • @YabbaDadADo
    @YabbaDadADo Před 5 lety +88

    Currently at 14:00 and crying into my cornflakes as just finally got to grips with Bloc pattern and now a new reccomended approach.

    • @filiphracek
      @filiphracek Před 5 lety +21

      If you like Bloc, stay with it!

    • @RichardVowles
      @RichardVowles Před 5 lety +2

      I believe the point is if you have trouble with Bloc, they recommend Provider and you can migrate to Bloc as you need.

    • @hviidlys
      @hviidlys Před 5 lety +3

      They literally said that bloc was perfectly fine and that they use it themselves. I think this was geared towards users who havnt made a choice yet and are confused by all the options and just want to be told 'use this'.

    • @karol-lisiewicz
      @karol-lisiewicz Před 5 lety +5

      The final conclusion of this talk was if you feel comfortable with BLoC or Redux there's nothing wrong in using them, there's no golden bullet for Flutter apps architectures.

    • @astralstriker
      @astralstriker Před 5 lety +1

      Can feel ya bud.. But I feel that BLoC will still be preferred for more complicated stuff.

  • @HossamKandil
    @HossamKandil Před 3 lety

    Great , clears a lot of ambiguity when choosing a state management

  • @joehsiao6224
    @joehsiao6224 Před 4 lety +4

    I feel lucky watching this video as I am two weeks into Flutter!

  • @PrabhuPatil-Hubli
    @PrabhuPatil-Hubli Před rokem +1

    Good job, Filip and Matt. You guys came to rescue when I was struggling with stateManagement in Flutter to get hold on it. Now its crystal clear and I know which pattern to go with and when. Choice is mine. Thanks a lot to both of you...🙏
    @Matt: Viewer would like to see you in new shirt in upcoming conference.... 😄

    • @flutterdev
      @flutterdev  Před rokem

      Glad to hear this is helping you on your Flutter journey 🚂
      Happy Fluttering 😎

  • @ravigarg7696
    @ravigarg7696 Před 4 lety

    It totally sounded like a Redux talk. Great to see Google's state management techniques transforming.

  • @mtdrip9523
    @mtdrip9523 Před 5 lety +1

    Hope you Google will continue these technolgoies you are putting out, i am so amazed by Go, Dart, Flutter

  • @adilmalik1232
    @adilmalik1232 Před 3 lety +1

    I am that much new to Flutter states that even, I found 6:57 really inspiring, and in fact I needed something like this for my recent projects lol
    Thanks for the video, it was really fun and informative :)

  • @yandelyano
    @yandelyano Před 4 lety +5

    "Thank you very much";
    "Great tutorial";
    "You're the best", and it goes on and on...
    Give honest feedback already!
    This is not personal and this applies to most content creators who teach flutter even Google's Flutter official channel, almost everyone is explaining things based on the assumption that the viewer comes from an app development background or that they already have been working with this "standalone" technology which is not so standalone if I had to get acquainted with other languages and frameworks to be able to understand its basics, people who started from scratch (to whom these crash courses should be addressed) are not accounted for whatsoever.
    This creates an entry barrier, this prevents the app/web dev communities to prosper and become richer, there may be people who could have had an influence on the current practices if they were taken into consideration.
    Again, this is not personal, I'm merely describing reality.

  • @leopapilaya
    @leopapilaya Před 5 lety

    Awesome Provider! I might need this in my last project!

  • @schinsky6833
    @schinsky6833 Před 4 lety +1

    1:00 Story of my (work-) life. i just love these guys!

  • @marcinszaek7564
    @marcinszaek7564 Před 5 lety +9

    The best Flutter duo

  • @777giba
    @777giba Před 5 lety +38

    Flutter Devs: What you need in state management?
    Me: yes!

  • @tamirsagi4544
    @tamirsagi4544 Před 5 lety

    You are doing a great job over there! thank you

  • @_iamoracle
    @_iamoracle Před 4 lety

    WOW! I am new to flutter and this video solved my problems!

  • @heshansandeepa9471
    @heshansandeepa9471 Před rokem +1

    One of the best tech reviewing videos i have ever seen. ❤

    • @flutterdev
      @flutterdev  Před rokem +1

      Thank you so much for the kind feedback, Heshan! We're so glad to hear you enjoyed this 😎

  • @0877adri
    @0877adri Před 5 lety

    I just read a chapter "Duplicate Observed Data" in the book "Refactoring" from 1999. As I understood this approach, it is super similar.

  • @julianfoster4064
    @julianfoster4064 Před 5 lety

    Great video! This was amazing.

  • @sorryim5977
    @sorryim5977 Před 3 lety

    Good video for how to use and link stateful widgets. Thanks a lot!

  • @danvilela
    @danvilela Před 5 lety

    These guys are awesome! The best on team flutter

  • @cbo4277
    @cbo4277 Před 4 lety +1

    14:22 this sentences sound so good!!

  • @bennychewDev
    @bennychewDev Před 4 lety

    This is very good stuff! Thanks for sharing.

  • @balajirajendran1406
    @balajirajendran1406 Před 3 lety

    I loved the way to presented, Great work

  • @goddardpk
    @goddardpk Před 3 lety

    Thanks for making this scary topic fun and entertaining. I almost forgot you guys were actually trying to teach :) - Look forward to seeing you guys again next year!

  • @gofudgeyourselves9024
    @gofudgeyourselves9024 Před 5 lety

    These guys share a great rapport

  • @jimmyfmedina
    @jimmyfmedina Před 5 lety

    Excelent speech, flutter is awesome!

  • @pi_mai
    @pi_mai Před 5 lety

    Love the small parts of humor!

  • @frshovon3852
    @frshovon3852 Před 3 lety

    Great talk. Helped me a lot.......

  • @LunfardoAR
    @LunfardoAR Před 5 lety +11

    new to flutter here, so this means you can create your whole app with providers and static widgets turning stateful widgets useless unless minor local state management?

  • @codingwithrudy
    @codingwithrudy Před 3 lety

    The whole video I was not sure if the fly is real or in the video... btw really nice info. I am starting to love Flutter

  • @zxenon_
    @zxenon_ Před 3 lety

    Great and pragmatic video.

  • @mjmontes2653
    @mjmontes2653 Před 4 lety +3

    Remi Rousselet is awesome for creating Provider

  • @roger_maia
    @roger_maia Před 4 lety

    It´s fantastic. Thank you.

  • @SergioArroyoSailing
    @SergioArroyoSailing Před 3 lety

    guys this was an awesome talk. Given that it's been more than a year, can you do a state of the art update on Pragmatic State Management? TIA !:)

  • @randomusername982374
    @randomusername982374 Před 5 lety

    I love these guys

  • @mahmoudmatar9588
    @mahmoudmatar9588 Před 3 lety

    Big Love to Google Flutter ❤️

  • @sodiboo
    @sodiboo Před 4 lety +6

    "We spent a long time thinking about how we could make the title of our talk the most exciting and clickbaity title we could make it"
    - Every single CZcamsr on this entire damn platform

  • @tanaaki5220
    @tanaaki5220 Před 2 lety

    Verry nice, thank so much 🥳🥳🥳

  • @SimonHalcrow
    @SimonHalcrow Před 4 lety +1

    Great session, thanks guys! Simple question re IDE usage, why are you using vsCode instead of Android Studio?

  • @sanukumar4845
    @sanukumar4845 Před 5 lety +82

    1. State Management: When we want to change the state of a widget from outside the widget, i.e. from another widget, network, or system call.
    //Example
    2. In the example the outside entity is: another widget.
    3. Making a global state is not a good idea as:
    a. It Increases Coupling,
    b. Not scalable as there may be more than one implementation of the widget,
    c. Calling set state from outside the widget is bad as we'll have difficulty figuring out who changed the state of the widget in case of multiple callers.
    4. Let the framework help you instead of fighting it.
    5. UI is a function of state in declarative frameworks: UI = f(state) ...(f = build methods that declare what the screen should look like at any given time)
    Hence only the state should mutate the UI and not the other UI elements themselves.
    6. In order to deal with our previous problem we lift the state up, i.e. make a model at the level that is accessible to both the widgets.
    7. When the value of MySlider changes, it notifies MySchedule. MySchedule in turn notifies all its listeners in this case, just MyChart and then notifies MySlider that the update was successful.
    8. History of flutter state management:
    a. Scoped model: Implementation of #7
    b. BLoC: Used for large scale applications. Difficult to understand, implement and a lot of boilerplate code, requires knowledge of Rx and Streams.
    9. Currently used: Scoped Model: features a lot of ad-on features to the scoped model.
    10. Mixins: medium.com/flutter-community/dart-what-are-mixins-3a72344011f3
    11. ChangeNotifier: adds listening capabilities to MySchedule: addListener, removeListener, dispose...
    12. Lift the state up. Use the ChangeNotifierProvider widget in MyApp as the parent of MyChart and MySlider.
    13. Use the builder in the widget to build the MySchedule model.
    14. Get reference of the model from the Widgets can be done by:
    a. Consumer, ...(a widget that contains a builder that provides the reference to the model)
    b. Provider.of(context)
    15. Update the model from it's reference inside the widget. For the listeners, update the listeners by the model reference.
    //State "Management"
    16. Disposables: Cleaning up when the widget is getting disposed of done with dispose callback of Provider. ChangeNotifierProvider does the dispose part for you.
    17. Break your state up into different components and classes to keep it simple. Use MultiProviders when needed.
    18. Use anything with the provider, streams, data, whatever

  • @pvc97
    @pvc97 Před 2 lety

    Very clear 👏

  • @theGoldyMan
    @theGoldyMan Před 5 lety +6

    @MattSullivan What is that modified version of Bloc pattern, could you share some details?

  • @fullemptiness
    @fullemptiness Před 5 lety +4

    For Xamarin.Forms developers, this is the nearest thing to the MVVM pattern, ChangeNotifier is like INotifyPropertyChanged

    • @rasmustchristensen
      @rasmustchristensen Před 5 lety

      and also the optimized way to check if you should notify or not.

  • @CarlosHFMRodrigues
    @CarlosHFMRodrigues Před 5 lety

    Really cool!

  • @dylanting1628
    @dylanting1628 Před rokem

    amazing share for provider .

  • @troglodylethol
    @troglodylethol Před 4 lety

    @29:24 haha....was waiting for that. All non-trivial apps that survive will eventually end up with dirty state management.

  • @rikyriky966
    @rikyriky966 Před 5 lety +2

    This made me think. I’m not convinced with the provider package too.
    I really think that Flutter team must find a better and simpler way for StateManagement. Flutter is great. I can develop and see the results really fast like never before.
    Sometimes, providing many solutions is bad.
    Especially in this video, even though the first approach was not good according to the Flutter team, I’d rather using it. At least the children widgets don’t have to be descendants of the same widget in the tree.
    These are my thoughts relative to my knowledge.

  • @benton202
    @benton202 Před 5 lety +17

    I watch this everytime i forget how to do this. so thats once a week...

    • @flobuilds
      @flobuilds Před 4 lety +1

      So i am in the club now? 😂 I needed exactly this now i can rewrite everything and i just realized you wrote this comment a year ago 😅

  • @AMIRULHAQE
    @AMIRULHAQE Před 3 lety

    this is super interesting

  • @sudolv
    @sudolv Před 4 lety +2

    Remember to turn down your volume after the video ends if you want to preserve your hearing.

  • @calebkiage7315
    @calebkiage7315 Před 5 lety

    #MattApproach is the truth!

  • @k1prestige
    @k1prestige Před 3 lety

    that was cool

  • @carloseugeniotorres
    @carloseugeniotorres Před 5 lety +8

    Thank you for the awesome presentation! Now a real and simple alternative for state management. Source code for the demo?

    • @BraulioCassule
      @BraulioCassule Před 5 lety +2

      github.com/2d-inc/developer_quest

    • @akilajayasooriya9533
      @akilajayasooriya9533 Před 4 lety

      Pragmatic State Management in Flutter (Google I/O'19) Example Replica:
      github.com/akilaj-oc/hello-flutter/tree/master/2_provider_pie_chart

  • @wearecode9199
    @wearecode9199 Před 4 lety +1

    I Believe Rx is the best since uses Behaviour thingy which unSubcribes by itself on dispose, hence you pass streams to StreamBuilders which dont need to render all the UI and only its subChildrens...

  • @hariangr
    @hariangr Před 5 lety

    I like this one

  • @chhinsras
    @chhinsras Před 2 lety +2

    What is best state management for flutter as of 2022?

  • @shazplay8878
    @shazplay8878 Před 3 lety

    Thanks

  • @truongsinhtran-nguyen7129
    @truongsinhtran-nguyen7129 Před 5 lety +15

    So if i'm comfortable w/ both BLoC and Provider, for the next big complicated app, should I use one instead of another? I could not deduce pros and cons of these 2 being compared to each other after watching this presentation.

    • @philippeparisot6061
      @philippeparisot6061 Před 5 lety

      This is what I'm wondering too...

    • @junpeiiori4720
      @junpeiiori4720 Před 5 lety +2

      In your experience, which is the most beginner friendly and easy to use approach among the 2?

    • @FilledStacks
      @FilledStacks Před 5 lety +5

      You can use both. The provider is a way to provide your state to your widgets. If you manage state through a BloC then you can provide that using the provider. The example here shows that. pub.dev/packages/provider#-example-tab-

    • @julianarnold7992
      @julianarnold7992 Před 5 lety

      Use the one you are most comfortable with. They are both great state management tools.

    • @kenthinson2980
      @kenthinson2980 Před 5 lety +1

      @@junpeiiori4720 package provider is easier then Bloc in my experience.

  • @dmitrypotenko4950
    @dmitrypotenko4950 Před 3 lety

    It would be nice if the description has the link to the source code with the complete example of the chart application.

  • @MrMiksug
    @MrMiksug Před 4 lety

    Gracias

  • @mahmoudfathy2074
    @mahmoudfathy2074 Před 5 lety +1

    I will use it with Bloc, because my current issue with Bloc is providing it through the widget tree, I hope it's efficient in that aspect though.

    • @filiphracek
      @filiphracek Před 5 lety +2

      Very efficient, yes. And provider makes it easy to clean up the provided objects, which comes handy with an approach like BLoC.

    • @honzabittner1856
      @honzabittner1856 Před 4 lety +1

      Also, try package:flutter_bloc :)

  • @skippersprint
    @skippersprint Před rokem +3

    The audience didn't pass the vibe check

  • @kld0093
    @kld0093 Před 4 lety +2

    Fireship dude also talked about this

  • @jakubradl9327
    @jakubradl9327 Před 4 lety

    Can anyone tell me, what Visual Studio extensions are they using for the stuff like "Wrap in a component", "Convert to statefull widget", etc.?

  • @kirill4531
    @kirill4531 Před 4 lety

    Where can I learn more about nested notifiers? I really often need to update something small within my ViewModel rather than notifying that my entire ViewModel was changed

  • @ninja4ever_
    @ninja4ever_ Před 5 lety

    mark~
    3:30 what is state management, widget
    approaches
    pragmatic

  • @mohammadazam3222
    @mohammadazam3222 Před 4 lety

    The notifyListeners() does not work when called from inside an async operation like fetching data from network.

  • @samsammy95
    @samsammy95 Před 4 lety

    4:56 Matt will "Pretend"??🤣🤣

  • @fauzytech
    @fauzytech Před 4 lety

    I have a online shop app which has a detail product screen. when user enters, the app should request to backend for detail product. Should i use provider in this case? since i think Provider is a global state management. While i just need the data only for detail screen, not anything else. I mean, notifyListener seems like useless in this case.

  • @muhammadkashif7209
    @muhammadkashif7209 Před 3 lety

    I love to learn google technologies.

  • @dharmang
    @dharmang Před 4 lety

    Basically React props and state 😂👍🏻

  • @sila227
    @sila227 Před 4 lety

    i have been search for good architecture for flutter to build my app
    i see tdd clean architecture but now i see provider is this is enough to build my app or must use some MVC ????

  • @climatechangedtsmailer3678

    Where can I get the code of the Chart and Slider using provider and change notifier from this demo????

  • @AriefSetiyoNugroho
    @AriefSetiyoNugroho Před 5 lety

    how if i have some routes, and i want to pass the provider to them?? so on destination route i just call the Provider.of(context)

  • @sunaarun6603
    @sunaarun6603 Před 5 lety

    Thank you for this information , but I want to ask you >> I new to declarative framework , and I want to build a big complex app with flutter , which approach will you recommend me to use it Redux or StreamBuilder , and why ?
    Because I don't know which on to use it >> I need advice from expert ..
    Thank you again

  • @stevenlyu2810
    @stevenlyu2810 Před 4 lety +1

    If you are interested in the fisrt demo , you can get it here :github.com/lvsj/control_chart_with_slider. There are several solutions, hope you like it.

  • @Jxrrdy
    @Jxrrdy Před 4 lety +2

    Liking this video because of 13:58 - 14:05 lol.

  • @vivekanandasuggu4247
    @vivekanandasuggu4247 Před 5 lety

    Very good explanation about the State mangament. I am loving the work with provider it's very ease to implement when compared with bloc. But why many people out there and In the medium suggesting the bloc. Can anyone help me out is there any down side in provider when compared to bloc. Thank you.

    • @kirill4531
      @kirill4531 Před 5 lety

      Flutter is a fastly evolving framework, always pay attention to the date of the post. If it's > 1 year consider it obsolete. Apparently, Provider package didn't exist back then

  • @Chisegh
    @Chisegh Před 5 lety +1

    Good talk. I'm new to Flutter, and since I come from a React background I used Redux for my first Flutter project. It's working just fine, but I'm not entirely sure what the best practices of initial data fetching in Flutter are. How is everybody fetching initial data?

    • @AIteek
      @AIteek Před 5 lety

      Im also curious about this... in initState() i am sometimes calling 3+ async methods and im not sure if i should chain them and call setState() at the end or use some other approach...

    • @nileshbhakre7050
      @nileshbhakre7050 Před 3 lety

      I am using bloc, for global state management..it gives complete control on initial state

  • @EmrahBilbay
    @EmrahBilbay Před 5 lety +2

    Project page: github.com/2d-inc/developer_quest

  • @greggdourgarian5853
    @greggdourgarian5853 Před 4 lety

    not seeing where this was posted anywhere else but the github link for the app at 20:11 is github.com/2d-inc/developer_quest

  • @maximeaubry2613
    @maximeaubry2613 Před 4 lety

    what do you think about pub.dev/packages/flutter_hooks ?
    is it a good practice to use it ?
    thanks.

  • @FelipeCampelo0
    @FelipeCampelo0 Před 5 měsíci

    I am a totally beginner, self-study. Should I understand it by simply watching to this video, or should I keep learning some more ?

  • @apinklas
    @apinklas Před 5 lety +1

    What plugin he just used?

  • @rockerirwin
    @rockerirwin Před 3 lety +1

    do you guys have the source code of the presented app ?

  • @adilbasharat
    @adilbasharat Před 3 lety

    Very informative! Thanks for the video.
    Although the jokes made me cringe

  • @gofudgeyourselves9024
    @gofudgeyourselves9024 Před 5 lety +1

    What about react Hooks??

  • @Tianex
    @Tianex Před 4 lety

    i should buy a same shirt,now++++