Flutter State Management with Provider 5

Поділитися
Вставка
  • Опубліковано 20 гру 2024

КОМЕНТАРІ • 65

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

    Thank you. This was the best Provider tutorial I came across. Subscribed.

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

      Thanks! Glad you liked it. A lot more flutter videos to come

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

    crystal clear explanation.. thank you very much Sir...🙏

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

    La mejor explicación de provider que he encontrado.

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

    Thanks a lot, i can't tell you how much useful it was

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

    Thank you Sir! Finally got what this is and how to use it! Yes new syntax is so nicely lighter :-) I get that CNP is just a "centralized" class holding data accessible from the whole app and you can link variables around your app to class variables. To me it's similar to a database table (with stored procedures to change values) with the only difference that you don't need to retreive data manually but it is automacally retrieved on update. Getting the high level concept makes it all so much easier to parse.

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

    perfect explanation! thanks! subscribed

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

    One of the greatest tutorials of Provider!
    I have a question, I have a List of data which I get with an API call, I use a GridView to make infinite scroll with several calls to the API.
    What is best to use for this, FutureProvider or StreamProvider?
    Thanks!

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

      Thanks for the kind words. What you're talking about isn't a stream. A stream is a flow of data. I also wouldn't try this using a FutureProvider as. the entire widget (including the list) will be rebuilt on each call which is bad for performance. I recommend this library. I've used it before and it's relatively easy to implement. You can just store your list in a ChangeNotifier and update the list as new data arrives. I might actually do a video about infinite scrolling in the near future.

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

    Thankyou sir...easy to understand explanation. You made my day ❤️

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

    great provider explanation

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

    Thank you for the great explanation, can we do this with API and perform crud operation using the provider. Any video or resources

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

      Check out the video I did on APIs. It will explain all that ua-cam.com/video/DRMYDjedLt0/v-deo.html

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

      One more thing, what's your take on using provider as state management while developing a social app. As you know a social app will have thousands of like and comments on daily basis and if provider is used as change notifier, would it cost extensive server call on each like or activity by user and eventually put pressure on backend ?

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

      State management and api calls are completely different layers in your app and have nothing to do with each other. If your state management solution is tied directly to your CRUD calls then you need to think about your architecture more. I like provider, but it will likely be overshadowed by RiverPod in the future. I also Like GetX a lot. It depends what futures of the each option I think I'll need.

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

    great explanation , you just gain a new subscriber, thank for share

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

    Good job, simple explanation

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

    14:48 at this point it gives me an error that says i cant use the consumer insider the list of widgets .whats the solution ?

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

    Great content, would it be possible to refresh state from web socket connection (2 way binding) if item of the list is updated from server?

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

    Thank you you got another subscriber

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

    Where do we have to initialise firebase in the main.dart along with the multiprovider??

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

      Wherever it makes sense for your app to do so. Either directly in the main or in the initState of the first widget if you want it to initialize when the app first loads.

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

    Awesome tubes bro but could you find a way to clear text easily upon onpressed add button ive been trying for days to work it out using textediting cotroller but it keeps breaking, appreciate maybe an updated tube with extra functions maybe adding firestore etc. cheerscheetah✌️

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

    Best tutorial.....I love it

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

    Instead of using removeWhere you can use removeAt which is simple and fast. By the way i learn a lot Thank you

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

      Thanks. In a real world app, if the data is coming from an API, you probably wouldn't want to remove an object based on the index. You would have a unique ID from each object (ie. Post ID, Comment ID, Review ID, etc), and you would remove based on that unique identifier. This is especially true during a real-time app where the object's index in the list can change very quickly between the time that an object is set to be deleted and when it is actually deleted.

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

      @@TheFlutterFactory I know we usually use unique ID (ie. Post ID, Comment ID, Review ID, etc) but you can still use removeAt because you we have List in our flutter app state.

    • @TheFlutterFactory
      @TheFlutterFactory  3 роки тому +5

      Like I said before, RemoveAt requires the index. That is not always guaranteed to remove the correct item if it has moved. The list can easily be reorded by other means before the data is removed. Think about a real world chatroom with 10,000 users. There is no guarantee that the item will be at the current index when the app tries to remove it. It could be instantaneous or it could be 5 seconds based on the written logic. RemoveWhere with a unique field guarantees that the correct item is removed regardless of both position and time.r
      Removet would be perfectly fine for static offline data, but RemoveWhere is more safe in general.

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

      @@TheFlutterFactory Got it Thanks

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

    is there a complete version of your codes in github?

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

    Can you please make a video on searching and filtering the list after retrieving it from Firestore?

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

    Hello, I'm new on Flutter Development
    What is the best Flutter project structures ?
    I've seen bloc version of resocoder, but, what about provider ?

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

      There is no "best". Choose one to learn first. You'll naturally learn about the others along your flutter journey. They are all useful in different circumstances

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

    Do you have full code for this one?

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

    i have a problem with the delete fuction when my cards have the same name and same city they are deleted all together when i press the button but when i have different names it works as expected

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

    hi, what is font in your editor ? It seems like something simple but I can't realise (( please, tell the name of the font.

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

    thank you sir

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

    thanks for this tutoral. please i have a little problem with my code, i got index not defined as error message when i tried to list the items. bellow is how i did it thanks. "Consumer(
    builder: (_, notifier, __) =>
    Text('Name: ${notifier.userList[index].name}')),

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

      Sounds like you didn't define the index variable. You shouldn't be using a consumer/selector inside the listview builder

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

    Bro, I have run web app .. flutter to firebase data added, But data not showing(List View) in flutter web app.. what can I do.. pls help me bro .

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

      Please keep the questions related to the video topics. I can't help everyone that has questions about their personal projects right now. I wish I had that kind of time 😊

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

    Good work...!

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

    I wish you could start provider from scratch you left me behind when you shifted from setState to provider

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

    thanks

  • @Mohammad-qg3pj
    @Mohammad-qg3pj 3 роки тому

    Thanks a lot

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

    sir thx for your video..
    but i have a problem and get the error about socket connection timeout.. and what should i do for that problem sir?

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

      Appreciate the kind words, but please keep the questions related to the topic of this video. This video has nothing to do with internet/web apis.

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

    Please.... Please... can you explain Riverpood like this video lesson

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

    👍👍

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

    I think consumer is no more needed you can simply say read and watch for real time changes much cleaner and easier

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

      I can tell that you didn't watch the entire video 😉

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

      @@TheFlutterFactory yes, you are right, honestly when i saw consumer i thought that would be lower version of provider, that's why i didn't watched entire video, but thanks 😊 it was so helpful.

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

      No problem. Consumer and Selector widgets are still very useful. If you have a StatelessWiget where every widget inside listens for the same data in a ChangeNotifier, it would make more sense to just wrap all the widgets in a single consumer widget instead of having context.watch everywhere. It's also good to know where context.read and context.watch came from. Consumer and Selector will never be deprecated.

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

    U should have started from scratch

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

      The goal of the video is to show how to use Provider. If you are trying to learn that then I should assume that you know how to do basic Flutter UI. All of my videos would be waaaay too long if I always show the basics like creating buttons, lists, etc.