Provider State management - ChangeNotifier + Flutter

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • Before we start with Riverpod I would like to talk about the good old Provider state management solution. The #Provider is a fantastic solution for state management and where the data come from.
    You like our work and would like to support us, feel free to join us on Patreon.
    / flutterexp
    Flutter State Management Docs
    flutter.dev/docs/development/...
    GitHub Repository
    Provider Tutorial: github.com/md-weber/state_tut...
    Provider Solution: github.com/md-weber/state_tut...
    If you use this kind of tutorial, it would be fantastic if you could give me some feedback on how to improve the current work.
    Feedback: github.com/md-weber/state_tut...
    Tools we use to grow our CZcams channel
    TubeBuddy Review - Manage Your CZcams Channel Easily
    www.tubebuddy.com/flutterexpl...
    Our current CZcams gear
    🎙 Samson Mic: amzn.to/324Gpof
    📟 Satechi USB-C Adapter: amzn.to/3kUdQ5M
    💻 MacBook Pro: amzn.to/3iQ9MBx
    📹 Lumix FZ1000: amzn.to/3g7tW8D
    ⭐️⭐️ Timetable ⭐️⭐️
    00:00 - Introduction
    00:22 - Provider Basics and Introduction
    04:45 - Provider in Code
    16:30 - Wrap up and Conclusion
    ⭐️⭐️ Follow us ⭐️⭐️
    Twitter Mahtab - / mahtab_dev
    Twitter Max - / flutter_exp
    GitHub Mahtab - github.com/mt-tadayon
    Github Max - github.com/md-weber
    Homepage - flutter-explained.org/blog
    ⭐️⭐️ Support ⭐️⭐️
    If you read this so far, thank you once more. If you like to support us, here are some links that could help me a lot.
    You help us with a small donation on flutterexplained.live

Komentáře • 54

  • @mivoligo
    @mivoligo Před 4 lety +34

    Let's say we need 3 providers for one widget. So instead of wrapping a widget with Consumer with Consumer with Consumer... we can wrap it with 'Consumer3' for example like this:
    Consumer3(
    builder: (context, oneProvider, anotherProvider, thirdProvider, child) {
    return MyCustomWidget(
    someValue: oneProvider.someValue,
    anotherValue: anotherProvider.importantValue,
    oneMoreValue: thirdProvider.somethingElse,
    );
    }
    According to documentation we can go up to Consumer6 like this.

    • @FlutterExplained
      @FlutterExplained  Před 4 lety +8

      That solves a lot of problems, thank you for sharing. I will pin it to the comments section so everyone will see it early. To make it easier readable, here is a carbon link: carbon.now.sh/k4Sf4SWoqQurH3oXHwEk

    • @ShafqatNadeem
      @ShafqatNadeem Před 2 lety

      thanks mivoligo

  • @Toasticuss
    @Toasticuss Před 4 lety +13

    Visualizing or diagramming the problem and visualizing the solution before jumping into coding would make your videos a lot easier to me.

    • @FlutterExplained
      @FlutterExplained  Před 4 lety

      That sounds like a great idea, thanks for the feedback I try to create a fitting diagram for the future videos.

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

    Thank you for making this. It took me multiple videos but this one really helped make sense of it all. Appreciated.

  • @delwarhossain43
    @delwarhossain43 Před 2 lety +1

    Nice. Good teacher. Thanks a lot. from Bangladesh.

  • @atlantis_expedition_member4747

    This is the best provider video I watched. Using the todo as a teaching method made it really easy to understand provider. Keep using it and the zoom level on the code.

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

    Excelent video. So far I have used callback functions and "passing data by refernece" but this looks nicer.

  • @makemypetgamedevprocess6475

    FINALLY AFTER SO MUCH BLOC AND SETSTATE I CAN USE PROVIDER-PERFECTLY EXPLAINED!! :)

  • @hemishpancholi
    @hemishpancholi Před 3 lety +2

    The video was very good. was able to understand the provider in seconds. I would suggest everyone see this video.

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

      Fantastic, I love that it helped you.

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

      @@FlutterExplained And also for VSCode we can use Pubspe assist extension for adding a package. It becomes so simple to add it. Just cmd+P and search Pubspec assist add the dependency. And type the name and done.

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

    Thank you for making this video.I liked the step-wise process.Easy to visualize

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

      Thank you I will try to keep it like that and bring more of this step to step tutorials :)

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

    I watched many tutorial videos but got it in this video. Thanks man!

  • @onuaugustine7276
    @onuaugustine7276 Před 2 lety

    wow, nice video. I like the way you explained everything clearly. Thank you.

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

    Thanks for making this tutorial. Its clear my doubts.

  • @deoneloff
    @deoneloff Před 3 lety +2

    Very good explanation and presentation!! Many thanks

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

    thanks man for the example it was so clear keep on

  • @Raimkhodzhanov
    @Raimkhodzhanov Před rokem

    Thank You! It was very interesting!

  • @askmrmoses
    @askmrmoses Před 2 lety

    Great explanation

  • @hardiklakhalani6268
    @hardiklakhalani6268 Před 2 lety

    Finally, I understood Provider Flow! Thanks a lot, Sir for TODOs method. 👍🏻 👍🏻 LIKED & SUBSCRIBE.

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

    Very clear explanation...thanks... :)

  • @kobi665
    @kobi665 Před 2 lety +1

    Great explanation!

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

    Thanks. Nice example. Looking forward to the Riverpod-video. But could you also make a video like this on the ProxyProvider and also how that is implemented in Riverpod? The TODO's are helpful by the way.

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

    Thanks for the video :)

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

    Great, thank you very much!

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

    thank you, nice content

  • @saidisa5956
    @saidisa5956 Před 2 lety +1

    Great episode! I liked how you explain every line you write, not too fast, not too slow, perfect base. just excellent!
    BTW, if my list is built from firestore, should I use change notifier provider (with subscription) or stream provider ?

    • @FlutterExplained
      @FlutterExplained  Před 2 lety +1

      Very good question, in general you can do both, but because you receive a stream from Firebase usually it is easier to directly use the Stream Provider.

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

    best explanation that i see on youtube! how much video there is :(

    • @FlutterExplained
      @FlutterExplained  Před 3 lety

      Wow, thanks! I am really happy that it helped you :)

    • @francescofreddi4374
      @francescofreddi4374 Před 3 lety

      @@FlutterExplained can i ask where i can find some official documentation about Flutter?
      i have some deep questions about Provider package...
      pub.dev/packages/provider here is not complete; i need a list of how much provider there is (such FutureProvider, StreamProvider... and so on).
      If cannot have a complete prospect of whats there are, how much i can do with all those different provider, i cannot use in a very confortable mode.........
      And now there is my super deep question:
      in a Flutter project, if i want to a simple Stream;
      how can I spread it in a widgetTree? If i use Provider instead StreamProvider.... or i use Provider to spread a Future results?????
      There is some problem???
      ThankSoMuch!

  • @waltherleonardo8652
    @waltherleonardo8652 Před 2 lety

    great video. It help me a lot.
    However, I think that the app in the video is still working with the setstatescreen instead of the provider screen where we were working on

  • @altearjen6838
    @altearjen6838 Před 3 lety

    would like to see an example with an auth provider, specifically for firebase

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

    Would you recommend provider state management for firebase app?
    I used it for my project and i'm not sure if I done it right by putting the provider inside a stream builder. All the example for the provider read and watch method is always triggered by onPressed or onValue changed event. But what is the event of new incoming stream called?

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

      That is a fantastic question. The event of a new incoming stream is going through the listen to the function of the stream itself, inside of that you can access the value of the stream and call the provider method that you want to execute. Alternatively you can use the await ... for loop for the stream to fulfil and handle the change.

  • @sankalpamokal9186
    @sankalpamokal9186 Před 2 lety

    How to call initstate if we are using stateless widget in this architecture?

  • @GuilhermeCarvalhoCarneiro

    Proceed to the information that the Provider should not be used in medium and large projects as a state manager 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

  • @AshishKumar-kx2ho
    @AshishKumar-kx2ho Před rokem

    Can you make a video on hook in flutter.