Riverpod State Management

Sdílet
Vložit
  • čas přidán 24. 09. 2020
  • Riverpod State Management
    The recommended Flutter state management is Provider. But Provider had a couple features that I really wanted to be a part of my state management. Thus I switched to GetX, because it seemed to solve those issues. Now there's a new solution developed by Remi Rousselet (creator of provider), and it is called Riverpod. It solves the main issues I had with Provider and more!
    Check out Robert's Channel: / robertbrunhage
    Link to the Code: github.com/tadaspetra/riverpo...
    Connect With Me
    ✦ My Website: [tadaspetra.com/](tadaspetra.com/#/)
    ✦ Live Coding: [ / tadaspetra ]( / tadaspetra )
    ✦ Twitter: [ / tadaspetra ]( / tadaspetra )
    ✦ Chat on Discord: [ / discord ]( / discord )
    ✦ Instagram: [ / tadaspetra ]( / tadaspetra )
    I also do lots of Investing
    ✦ FREE stock: [join.robinhood.com/tadasp2](join.robinhood.com/tadasp2)
    My Top 5 Books:
    ✦ Brave New World - Aldous Huxley: [amzn.to/2JyaK96](amzn.to/2JyaK96)
    ✦ 1984 - George Orwell: [amzn.to/3lmLzUk](amzn.to/3lmLzUk)
    ✦ The Millionaire Fastlane - MJ Demarco: [amzn.to/2ViGthn](amzn.to/2ViGthn)
    ✦ The 4-Hour Workweek - Timothy Ferriss: [amzn.to/3mnypYD](amzn.to/3mnypYD)
    ✦ Homo Deus - Yuval Noah Harari: [amzn.to/2VlFRYe](amzn.to/2VlFRYe)
    CZcams Gear
    ✦ MacBook Pro 16 inch: [amzn.to/3qe4MeF](amzn.to/3qe4MeF)
    ✦ MX Master 3 Mouse: [amzn.to/2VlkZQS](amzn.to/2VlkZQS)
    ✦ Canon Rebel SL3: [amzn.to/2ViIfPv](amzn.to/2ViIfPv)
    ✦ Hiearcool USB Hub: [amzn.to/3llsIsP](amzn.to/3llsIsP)
    ✦ iPad Pro 12.9 (3rd Generation): [amzn.to/36kaVy0](amzn.to/36kaVy0)
    ✦ Apple Pencil (2nd Generation): [amzn.to/2JoHy4y](amzn.to/2JoHy4y)
    ✦ Yeti Microphone: [amzn.to/37oRNOq](amzn.to/37oRNOq)
    ✦ Rode Boom Arm: [amzn.to/3lnEKCb](amzn.to/3lnEKCb)
    ✦ Blue Radius II Shock Mount: [amzn.to/2JoIfea](amzn.to/2JoIfea)
    ✦ Blue RPop Filter: [amzn.to/39rQSiZ](amzn.to/39rQSiZ)
    ✦ Sony WH1000XM3: [amzn.to/3moWgHh](amzn.to/3moWgHh)
    Thank you for watching!
    #riverpod #flutter #statemanagment

Komentáře • 88

  • @vatan2578
    @vatan2578 Před 3 lety +7

    You are a good person. I wish you and your loved ones health and happiness.

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

      KENAN DEMİR thank you very much! I really appreciate it 😊

  • @andredealbuquerque7699
    @andredealbuquerque7699 Před 3 lety +3

    Testing is very important! Just found your channel and started learning how to code recently. Do more of those for sure :)

    • @tadaspetra
      @tadaspetra  Před 3 lety

      Nice, good luck on your coding journey 😊

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

    Great video, I saw lots of video about riverpod, but didn't get. You explanation is amazing. Thank you so much.

    • @tadaspetra
      @tadaspetra  Před 3 lety

      Khan Israr Ahmed Ali Husain thank you! That means a lot 😊

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

    Thank you soo so much... I have been searching for an easy to understand riverpod video, and this is the one that made most sense.
    Thank you.

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

      My pleasure 😊 glad I could help

  • @RobertBrunhage
    @RobertBrunhage Před 3 lety +6

    Great video! Those editing skills are starting to show I see!

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

      Robert Brunhage haha slowly but surely 😊

  • @silverCap00
    @silverCap00 Před 3 lety

    Good lecture! Always very very very very thanks to you!

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

    Amazing explanation!

  • @quicksketch1617
    @quicksketch1617 Před 3 lety

    CZcams have a lot of tutorials, this is very good for those that are learning and doesn't have much programming experience

  • @otolulope
    @otolulope Před 3 lety

    Guy, you are the best.

    • @tadaspetra
      @tadaspetra  Před 3 lety

      Thank you!! I am planning another Riverpod video soon

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

    Thanks, good video.

  • @sunritjana4573
    @sunritjana4573 Před 3 lety +3

    Haha, even though I am dumb, when it comes to flutter, this was an amazing explanation, and i really love it!

    • @tadaspetra
      @tadaspetra  Před 3 lety

      Sunrit Jana thank you! I really appreciate it!!

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

    Hi, what a nice video! have you ever found any issue with unit test for both GetX and Riverpod? What do you think about which one of them that is easier to test?

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

      So I haven’t worked with Riverpod and testing yet. But to be honest I think both of them would be pretty easy to test. The fact that it is a state management solution makes testing easier because you can load specific states in.

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

    Best Riverpod starter tutorial on youtube, thanks a lot. One question: Do you know why my hotreload via android studio doesnt work whenever I change something in the providers.dart file? The app restarts but nothing works, even the circular indicators are stuck and not showing properly. have to close the app and clear cache every time, only then things work.

    • @tadaspetra
      @tadaspetra  Před 3 lety

      That's really weird. Whenever working within the providers, I sometimes need to hot restart, but that is because there is a different provider in cache than the new one that I updated

    • @renanmendes35
      @renanmendes35 Před 2 lety

      I was having a similar issue with any of my flutter apps. Solved running app (even on debug mode!) using VsCode --> Run --> Run Without Debug. Of course this only applies if you're using VSCode too... With Android Studio everything always worked out for me.

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

    Hey man, I've been thinking about learning a state management framework for flutter. Looking at your channel there are many videos on the topic but which one would you recommend starting with?

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

      Abhishek Rawat to start with I would try GetX. It is the simplest one for sure. Then the flutter recommended is Provider, but it has a couple nuances that I dislike. So I would go with Riverpod over that. So Riverpod or GetX in my opinion are the ones I would use

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

      Thanks!

    • @tadaspetra
      @tadaspetra  Před 3 lety

      Abhishek Rawat no problem!

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

      @@abe10 Riverpod for sure.

    • @abe10
      @abe10 Před 3 lety

      @@meansnada Hey man, thanks!

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

    I saw your testing videos bro

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

    Dear Tadas,
    The Stream you've shown here is left open, how can i make sure once the stream reaches 5 as the number, to close it?
    Thanks!

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

      In a real scenerio, you should probably uses statenotifier or changenotifier, with a stream state and you can have methods in those that cancel the stream

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

    Do you recommand a particular state manager when we use graphql for flutter?

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

      I haven’t actually used graphql so idk if I’m the best person to give advice for that

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

    Your videos are great your explanation is great, just because im almost blind please put your code bigger, please! still liked the video

    • @tadaspetra
      @tadaspetra  Před 3 lety

      haha, I will see if I can make it a little bit bigger, thank you for the feedback 😊

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

    Is there any difference between the different types of state management in terms of performance? Like is one fatster/more efficient than the other in some cases and vice versa?

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

      Indrajit Roy there probably technically is a difference. However, it will be a very small difference that should not affect any noticeable performance

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

      @@tadaspetra Right. Thanks!

  • @billiardoxx
    @billiardoxx Před 3 lety

    As you have used GetX and Riverpod, could you explain pros and cons of each of them? Why should we choose one of them? After your video I think GetX is more easy to use.

    • @tadaspetra
      @tadaspetra  Před 3 lety +3

      I basically recommend this, GetX is easier to learn and great for beginners, but Riverpod has a lot of nice features and makes your code safer. So if you are a beginner or want simplicity go with GetX, if you are confident in your skills and would like these nice features try out riverpod

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

      End of the day whatever one works best for you is the one to stick with!

    • @billiardoxx
      @billiardoxx Před 3 lety

      @@tadaspetra Ok, I agree with that, BUT how does Riverpod make your code safer? can you explain it in more detail? Thanks.

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

      @@billiardoxx I actually just put out a new video on it. But for example if you use a future provider, you HAVE to handle loading and error states, or else Riverpod will show you a warning

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

    Any reason why you might choose ChangeNotifierProvider over StateNotifierProvider? They seem to do pretty much the same thing?

    • @tadaspetra
      @tadaspetra  Před 3 lety +3

      StateNotifier is immutable, while ChangeNotifier is mutable. Depends which one you prefer

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

      @@tadaspetra ah right. good to know the difference. thanks for the reply.

    • @Lensbreak
      @Lensbreak Před 3 lety

      exactly my question thanks haha

    • @aymanhamedmoustafa
      @aymanhamedmoustafa Před 3 lety

      I think you may use ChangeNotifier if you want to listen to more than one variable

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

    Can you do a tutorial on calling native code/plugins from flutter also dart ffi

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

      Mr Random this is a topic I've been meaning to look into!

  • @rounaktadvi4950
    @rounaktadvi4950 Před 3 lety

    Which VS Code theme you use?

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

    flutter hooks is 3rd party packge or by Google ?

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

      It's another package by Remi (the guy that made Provider), but rumor has it, Google might add it into Flutter itself

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

    Riverpod with Statefulwidget?? can u pls explain

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

      So you don't really need to use StatefulWidget when you're using Riverpod. If you wrap all the things that actually change within a provicer, then it should be handled.

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

    Can we create stateProvider of String?

  • @twobits7310
    @twobits7310 Před 3 lety

    I am new to development, I have a question, is state management and architecture pattern two different things?

    • @tadaspetra
      @tadaspetra  Před 3 lety

      Yes. State management is a how you maintain state throughout your application. Architecture pattern is how the whole application is laid out. They are tied together very often because how you manage state will dictate how your app architecture is laid out. Basically good architecture patterns USE state management.

    • @twobits7310
      @twobits7310 Před 3 lety

      @@tadaspetra how many architecture patterns for flutter? (Suitable for flutter)

  • @mhmdibrahim6598
    @mhmdibrahim6598 Před 3 lety

    thanks...can you make an app using getx & firebase

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

      I actually made a todo app with getx & firebase czcams.com/play/PL26uY6-lIzqm-P1_Hi072D9FzwltjhAGG.html

  • @dantedt3931
    @dantedt3931 Před 3 lety

    0:00 Your last what?

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

    It's not easier than I thought 😅

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

      It is a bit more complex, but I think if you get comfortable with it, it's a lot more powerful

    • @void4904
      @void4904 Před 3 lety

      @@tadaspetra in this time. i'm enjoying with Riverpod. Thanks for your insight :)

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

    You should give Momentum a try next

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

      I haven't even heard of that one. There are so many haha. But Momentum has some nice documentation!

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

      @@tadaspetra yeah momentum is pretty cool. it's by one guy and I accidentally found it by chance on reddit and I'm surprised not more are talking about it. There's so many though, I tend to stick to the ones w/ solid documentation. I haven't stuck to one just yet, I'm sure we'll see even more in the coming months as things are picking up in the flutter world.

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

      G4MR Plays I hope they stop lol. I feel like it’s best to just pick one and go with it. I’ll probably be sticking with Riverpod and GetX depending on the app 😊

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

      @@tadaspetra lol yeah same, I'm going to dabble with Riverpod, but probably stick with Momentum from now.

  • @tinchocbaar
    @tinchocbaar Před 3 lety +3

    GetX or Riverpod ???
    this is the question!!

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

      haha they are both great! I think depends what you are looking for. I like the structure of GetX and the simplicity, but I also like the safety of riverpod

    • @tinchocbaar
      @tinchocbaar Před 3 lety +3

      @@tadaspetra
      watch your video quickly !! when you say "security" you mean the states data: loading: error: in for example the Future ??

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

      Martin Melchior yes. With Futures and Streams it covers all the cases and gives an error if you are missing one

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

      I prefer getx as it reduces code size

  • @saadmansoor3547
    @saadmansoor3547 Před rokem

    udpate the video bro

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

    The best?

    • @tadaspetra
      @tadaspetra  Před 3 lety

      Mitzuko Davis no no. No such thing as the best for any solution. But in my opinion, better then provider

  • @ankitrathore3946
    @ankitrathore3946 Před 3 lety

    The thing you are calling ref .. it is context .. renaming it doesn't mean sense.. if you cant access it outside of build method.. then you can't say that .. it is not depend on context .. but you can say that it hi des the complexities of provider..

    • @tadaspetra
      @tadaspetra  Před 3 lety

      It is named "ref" in the documentation and it is technically a ProviderReference. What you say is true, but I don't think there's any problem with naming it ref

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

    Easy peasy, but not Getx easy lol

    • @tadaspetra
      @tadaspetra  Před 3 lety +3

      j heisler yes exactly. But there are some benefits, it is more safe and all cases need to be covered or you will get an error