Flutter State Management with Provider 5

  Рет қаралды 25,991

The Flutter Factory

The Flutter Factory

Күн бұрын

Provider is an excellent choice to manage state in your Flutter apps. I talked about Provider version 3 in a previous video. This is an updated version.
💻Follow along here with the initial code: github.com/the...
⚡Connect on Facebook: / flutterfactory
⚡Connect on Twitter: / flutterfactory
🎷Music: www.bensound.c...

Пікірлер: 65
@chummyigbo8844
@chummyigbo8844 3 жыл бұрын
Thank you. This was the best Provider tutorial I came across. Subscribed.
@TheFlutterFactory
@TheFlutterFactory 3 жыл бұрын
Thanks! Glad you liked it. A lot more flutter videos to come
@wjbtc4395
@wjbtc4395 2 жыл бұрын
La mejor explicación de provider que he encontrado.
@alhambase7468
@alhambase7468 2 жыл бұрын
crystal clear explanation.. thank you very much Sir...🙏
@neangphearom5635
@neangphearom5635 3 жыл бұрын
great provider explanation
@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.
@sahilverma4077
@sahilverma4077 3 жыл бұрын
Thanks a lot, i can't tell you how much useful it was
@sdewangan7
@sdewangan7 3 жыл бұрын
Thankyou sir...easy to understand explanation. You made my day ❤️
@TheMarchukav
@TheMarchukav 3 жыл бұрын
perfect explanation! thanks! subscribed
@senor7857
@senor7857 3 жыл бұрын
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.
@vinchuli8737
@vinchuli8737 2 жыл бұрын
Best tutorial.....I love it
@kecudotcom
@kecudotcom 3 жыл бұрын
Good job, simple explanation
@moorthy2791
@moorthy2791 2 жыл бұрын
thanks
@trungledang5225
@trungledang5225 3 жыл бұрын
thank you sir
@shahrukhkhan3967
@shahrukhkhan3967 3 жыл бұрын
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 жыл бұрын
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
@haroldpepete
@haroldpepete 3 жыл бұрын
great explanation , you just gain a new subscriber, thank for share
@ravikumarmistry
@ravikumarmistry 3 жыл бұрын
Thank you you got another subscriber
@DreamBigEducation
@DreamBigEducation 3 жыл бұрын
Good work...!
@Mohammad-qg3pj
@Mohammad-qg3pj 3 жыл бұрын
Thanks a lot
@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✌️
@oguzarslandas3022
@oguzarslandas3022 2 жыл бұрын
👍👍
@vijaybabaria3253
@vijaybabaria3253 2 жыл бұрын
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?
@parthdesai84
@parthdesai84 3 жыл бұрын
Can you please make a video on searching and filtering the list after retrieving it from Firestore?
@zaheeruddinbaber6762
@zaheeruddinbaber6762 2 жыл бұрын
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 2 жыл бұрын
Check out the video I did on APIs. It will explain all that kzbin.info/www/bejne/eoOwinegmsl_qpI
@zaheeruddinbaber6762
@zaheeruddinbaber6762 2 жыл бұрын
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 2 жыл бұрын
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.
@abdallahhussein5997
@abdallahhussein5997 2 жыл бұрын
I wish you could start provider from scratch you left me behind when you shifted from setState to provider
@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
@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.
@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 ?
@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 2 жыл бұрын
Do you have full code for this one?
@maxtay9948
@maxtay9948 3 жыл бұрын
is there a complete version of your codes in github?
@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.
@TheFlutterFactory
@TheFlutterFactory 3 жыл бұрын
FiraCode
@yusufumar6738
@yusufumar6738 2 жыл бұрын
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 2 жыл бұрын
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 жыл бұрын
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 😊
@francescofreddi4374
@francescofreddi4374 3 жыл бұрын
Please.... Please... can you explain Riverpood like this video lesson
@TheFlutterFactory
@TheFlutterFactory 3 жыл бұрын
Soon 🙂
@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.
@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 жыл бұрын
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 жыл бұрын
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 жыл бұрын
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.
Moving from setState to Riverpod in Flutter Part 1
36:00
The Flutter Factory
Рет қаралды 18 М.
Flutter Provider 5 changeNotifier Example | State Management
10:15
Learn Flutter with Me
Рет қаралды 24 М.
escape in roblox in real life
00:13
Kan Andrey
Рет қаралды 15 МЛН
Touching Act of Kindness Brings Hope to the Homeless #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 18 МЛН
Glow Stick Secret Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 19 МЛН
API Call using Provider | Flutter State Management
11:26
Nitish Kumar Singh
Рет қаралды 20 М.
Flutter Provider Package In Depth - Change Notifier Provider
49:53
Managing state in Flutter with Provider (Version 3)
29:01
The Flutter Factory
Рет қаралды 21 М.
REST API with GetX | Flutter tutorial | Shopping app
26:43
7 Common Flutter Providers Explained
18:57
Learn App Code
Рет қаралды 19 М.
State Management in React Native with Mobx - The Basics
21:54
The Flutter Factory
Рет қаралды 12 М.
Pragmatic State Management in Flutter (Google I/O'19)
33:25
Flutter
Рет қаралды 450 М.
How to Communicate with REST APIs in Flutter
1:06:12
The Flutter Factory
Рет қаралды 16 М.
escape in roblox in real life
00:13
Kan Andrey
Рет қаралды 15 МЛН