Flutter Redux - Single Source of Truth - State Management

Поділитися
Вставка
  • Опубліковано 22 лип 2024
  • Redux State management is one of the older state management solutions in Flutter environment, but it still amazing. Brian Egan, the maintainer of the package, does a great job to bring over all the benefits and smarts from the old JS Redux Package into today's Flutter Redux Package. In today's video, we will have an overview with a coding example, and I will demonstrate it in our Drinks Example.
    Timetable:
    00:00 Introduction
    00:33 Redux Introduction
    04:02 Find the Branch for Redux State Management
    18:00 Additional Tools and Tips around Redux
    Helpful Links:
    github.com/md-weber/state_tut...
    #Redux #StateManagement #Flutter
    ** New Mentorship Program to boost your Flutter career **
    gumroad.com/l/ydgtfV
    **BOOKS I RECOMMEND**
    geni.us/flutterbook
    geni.us/clean-code
    ** UA-cam OPTIMIZATION PLUG-INS I USE **
    TUBEBUDDY: www.tubebuddy.com/flutterexpl...
    VIDIQ: vidiq.com?afmc=7jl
    **ALL THE UA-cam EQUIPMENT I USE**:
    Our current UA-cam gear
    💻 MacBook Pro: geni.us/mac-book
    📹 Lumix FZ1000: geni.us/fz-1000
    🎙 Samson Mic: geni.us/samson-mic
    🎉 ACCESSORIES:
    Satechi USB-C Adapter: geni.us/P9R0
    SD Card for 4k Videos: geni.us/PTAc
    Disclaimer Flutter Explained (Max & Mahtab) are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to www.amazon.com.
    ** Social Medias **
    Website: flutter-explained.dev
    Say hi to Max
    Twitter: / flutter_exp
    GitHub Max: github.com/md-weber
    LinkedIn: / max-weber-9889a3ba
    Say hi to Mahtab
    Twitter Mahtab: / mahtab_dev
    GitHub Mahtab: github.com/mt-tadayon

КОМЕНТАРІ • 35

  • @Charanms
    @Charanms 2 роки тому

    Thanks, you made it really easy to understand the concept .

  • @geoffreyngugi6144
    @geoffreyngugi6144 3 роки тому +1

    This is nice, i did not know we could use redux with flutter. This is great

  • @Dolphintcd
    @Dolphintcd 3 роки тому

    awesome video!

  • @RubberDuckCoding
    @RubberDuckCoding 2 роки тому

    VERY NICE!

  • @rohithaponnathota5149
    @rohithaponnathota5149 3 роки тому

    Sir, if I have more actions do I have to write more reducer functions to update state.. And how to do.. That.. Can you please explain

  • @mauriii
    @mauriii 3 роки тому +1

    Good video, I would recommend showing how the app works first so that viewers know what is being discussed in code

  • @RedmiA-wr3gc
    @RedmiA-wr3gc Рік тому

    which is best State Management solution for flutter which can be used in large Project.

  • @You3gs
    @You3gs 3 роки тому

    if someone is getting the following error when intializing the state in main.dart The argument type 'AppState' can't be assigned to the parameter type 'AppState Function(AppState, dynamic)'. JUST REMOVE () FROM updateDrinksReducer funtction

  • @stefaandeconinck1531
    @stefaandeconinck1531 3 роки тому +1

    Thanks for the very clear explanation. Even for a newbie with less than 1y experience. The only question I have about the complete state management topic. How to choose the best state management solution for a project? What are the arguments to make such a decition.

    • @FlutterExplained
      @FlutterExplained  3 роки тому +3

      Excellent question, actually the idea of my state management series is that everyone sees slowly that they are actually pretty similar at the end. Hence, there is no absolute need to decide on the best one.
      Some are better for a specific use case some are better in other use cases. Important is to stick with one and also understand the differences.

  • @_dinesh
    @_dinesh Рік тому +1

    Great tutorial thank you. The only thing I dislike about redux is the name "reducer" is not very intuitive. I think the word "manager" or "worker" is more appropriate. Look forward to hearing others thoughts.

  • @VishvajeetSuryawanshi
    @VishvajeetSuryawanshi 3 роки тому +2

    amaazzzzzzinggggg...

  • @rahulrameshbhai3946
    @rahulrameshbhai3946 Рік тому

    How to update specific variable of ViewModel in Redux State Management?
    Like Selector Widget in Provider State Management and BlocSelector Widget in Bloc State Management to update specific variable of ViewModel.

  • @lucianomartinez27
    @lucianomartinez27 3 роки тому +1

    Why do you check the action type instead of using polymorphism?

    • @FlutterExplained
      @FlutterExplained  3 роки тому +1

      I just wanted to make sure that my IDE understands which type it is.

  • @kushalsoniadvocate
    @kushalsoniadvocate 3 роки тому

    where is code?

  • @zuhrulanam5971
    @zuhrulanam5971 4 місяці тому

    im new in redux, i think its more complex than provider

  • @someonlinevideos
    @someonlinevideos 2 роки тому +1

    I was curious why you mutated the value for selectedDrink outside of the reducer.
    I enjoyed watching but I believe that violates a principle of redux where we want to isolate values that change in one central location; ie the store and more specifically, within the set of the store’s reducers.
    Thanks for clarifying if you can 🎩

    • @FlutterExplained
      @FlutterExplained  2 роки тому +1

      Hi Michael, first of all, thanks for your feedback. That is actually a very valid question. To give you the best possible answer, I searched a bit around foremost inside of the invoice ninja repository:
      github.com/invoiceninja/admin-portal/blob/master/lib/redux/
      They have a lot of examples for reducers. From my personal understanding, which could be wrong, I do not want to have computations inside my reducers, just bare there is a new value and store it please inside the Store.
      A reducer is the only place where I can mutate the store to mutate the values I am allowed to do that before. A basic example is a side effect like a network request. But, according to the principles, I am not allowed to do them inside a reducer, so I need to get the values first and pass them in the reducers.
      I hope that helps :) and if you have more questions, feel free to contact me anytime.

    • @someonlinevideos
      @someonlinevideos 2 роки тому +1

      @Flutter Explained it’s very interesting here because I think we agree on the rules, guidelines rather, this architecture recommends; but I think we’re off with what should be doing what. Could be an interesting conversation for a podcast of mine I’m starting about resolving misunderstandings amongst respectful adult software engineers in good faith. Let me know if you’d be interested in checking it out. Im still in the phase of building up a catalog, but I’d love to get a pilot episode with such a great explainer.

    • @FlutterExplained
      @FlutterExplained  2 роки тому

      @@someonlinevideos Sure feel free to contact me via my mail or in discord :)

    • @avalanche2073
      @avalanche2073 2 роки тому

      @@FlutterExplained short synchronous mutations like in your case are ok to be put in reducer. If you really want to follow the convention then this mutation should be put inside Middleware. By putting mutation inside onPressed you are doing state management outside Redux which defeats its purpose.

  • @francescofreddi4374
    @francescofreddi4374 3 роки тому +1

    uauu probably i lost some video where you explain in more details Redux for flutter :(............. this i need to understand all better

    • @FlutterExplained
      @FlutterExplained  3 роки тому

      Sorry, this is just a beginning, not a really deep dive of Flutter Redux. I will add a deep dive into my open topic lists. What would you like to hear in such a video?

    • @francescofreddi4374
      @francescofreddi4374 3 роки тому

      @@FlutterExplainedfor example how to use Middleware... if I have something in state more complex than a bool type....
      and how to think with redux... when I see you I feel very little little and I think.... ok, with calm you probably understand all this thinks :)

  • @narcissisticnarcissus4956
    @narcissisticnarcissus4956 3 роки тому +1

    Redux wasn't created by Facebook.
    Redux is older than Facebook itself.

    • @FlutterExplained
      @FlutterExplained  3 роки тому +1

      Hi there, really I did not know that. According to my research Facebook was founded 2004 and Redux (at least the here refered JS Library) was published in 2015. Additionally I think Dan Abramov and Andrew Clark invented it. Maybe it was not Facebook itself who invented the Library but both are decorated Engineers at Facebook. It would be great if you could give me more insights :)

  • @slapnuts4658
    @slapnuts4658 9 місяців тому

    "the state is immutable" but also "only the reducer can change the state" ????

    • @FlutterExplained
      @FlutterExplained  9 місяців тому +1

      Well yes, the state is and should be immutable the reducer is not really changing the state it is more an update of the current state. So we replace the old object with a totally new object.
      That is because of the second principle of Redux: State is read-only
      github.com/fluttercommunity/redux.dart/blob/master/doc/why.md#2-state-is-read-only
      I hope that made it a bit more clear.

    • @slapnuts4658
      @slapnuts4658 9 місяців тому +1

      @@FlutterExplained thanks for your answer. I got it already but sometimes a little bit confusing what you mention in the Video

    • @FlutterExplained
      @FlutterExplained  9 місяців тому +1

      Alright glad to hear that, sorry if it was a bit unconcice I try to improve in the future. Thanks for your feedback!

  • @rockstylex33
    @rockstylex33 3 роки тому +2

    All I ever learn from these Redux videos that it is a horrible piece of over complicated trash and I would never want to use it. That goes for any of these state management packages. Seems like there are much easier straight forward ways of doing the same thing. I think it's just another band wagon the IT world is jumping on for no reason.

  • @barry.anderberg
    @barry.anderberg 2 роки тому

    the zooming in and out while you talk is really distracting

    • @FlutterExplained
      @FlutterExplained  2 роки тому

      Thanks for your feedback, I will talk with my editor and see if we find a better solution for future videos.