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.
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!
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.
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 ?
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.
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.
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✌️
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.
@@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.
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.
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
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
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}')),
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 😊
@@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.
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.
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.
Thank you. This was the best Provider tutorial I came across. Subscribed.
Thanks! Glad you liked it. A lot more flutter videos to come
crystal clear explanation.. thank you very much Sir...🙏
La mejor explicación de provider que he encontrado.
Thanks a lot, i can't tell you how much useful it was
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.
perfect explanation! thanks! subscribed
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!
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.
Thankyou sir...easy to understand explanation. You made my day ❤️
great provider explanation
Thank you for the great explanation, can we do this with API and perform crud operation using the provider. Any video or resources
Check out the video I did on APIs. It will explain all that ua-cam.com/video/DRMYDjedLt0/v-deo.html
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 ?
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.
great explanation , you just gain a new subscriber, thank for share
Good job, simple explanation
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 ?
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?
Thank you you got another subscriber
Where do we have to initialise firebase in the main.dart along with the multiprovider??
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.
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✌️
Best tutorial.....I love it
Instead of using removeWhere you can use removeAt which is simple and fast. By the way i learn a lot Thank you
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.
@@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.
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.
@@TheFlutterFactory Got it Thanks
is there a complete version of your codes in github?
Can you please make a video on searching and filtering the list after retrieving it from Firestore?
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 ?
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
Do you have full code for this one?
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
hi, what is font in your editor ? It seems like something simple but I can't realise (( please, tell the name of the font.
FiraCode
thank you sir
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}')),
Sounds like you didn't define the index variable. You shouldn't be using a consumer/selector inside the listview builder
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 .
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 😊
Good work...!
I wish you could start provider from scratch you left me behind when you shifted from setState to provider
thanks
Thanks a lot
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?
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.
Please.... Please... can you explain Riverpood like this video lesson
Soon 🙂
👍👍
I think consumer is no more needed you can simply say read and watch for real time changes much cleaner and easier
I can tell that you didn't watch the entire video 😉
@@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.
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.
U should have started from scratch
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.