Flutter Provider Http Request With Example | State Management

  Рет қаралды 19,100

dbestech

dbestech

Күн бұрын

Learn about Flutter Provider Http Request with example.
Complete code is here
www.dbestech.com/tutorials/fl...
😇😇😇😇Same app three versions Riverpod, BLoC and Getx. Check which one you like
• Flutter Getx BLoc and ...
📚📚📚
Twitter
@dbestech
0:00 Introduction
0:16 Install provider package
0:40 Understand your data model for provider
1:14 Create data model
1:54 Create data model class
2:18 Create service class for loading data using provider
2:29 Service class
3:46 Data class with ChangeNotifier
4:24 Create ChangeNotifierProvider
4:54 Create a new stateful class
5;15 Create Initstate method for loading data by calling provider.of
Provider complete app
www.dbestech.com/tutorials/fl...

Пікірлер: 60
@someshsahu4638
@someshsahu4638 11 ай бұрын
nice explanation thank you so much 🙏🏼🙏🏼🙏🏼
@demodemo9429
@demodemo9429 2 жыл бұрын
You are indeed an great teacher sir ,tq for the lessons😍
@dbestech
@dbestech 2 жыл бұрын
So nice of you
@MdSiam-kw5ox
@MdSiam-kw5ox 2 жыл бұрын
Thanks a lot, mate 👍
@dbestech
@dbestech 2 жыл бұрын
Welcome
@kurshadqaya1684
@kurshadqaya1684 2 жыл бұрын
Hello. As salamu aleykum. Man, you can't imagine how helpful these short videos are. They are quite to the point. If I wanted to know this simple get data and use it with provider by watching some long videos which contain this part, more likely I wouldn't learn that much and waste my time. But you just choose topic(very practical topic). Then write all steps(1-6 here for ex. very very helpful to reinforce and wrap head around). Thanks a ton. This one video helped me more than some long videos! Thank you very much! I want to be a friend with you. How can I get in touch with you? I mean a real friend. Not for abusing you. Va rahmatulla! I am also a muslim from Azerbaijan!
@dbestech
@dbestech 2 жыл бұрын
Yes, I have realized that too. So I am making short videos every day.
@azamovdev
@azamovdev Жыл бұрын
very nice
@dbestech
@dbestech Жыл бұрын
Thanks a lot
@andrewJacop
@andrewJacop Жыл бұрын
fantastic video sir good job
@dbestech
@dbestech Жыл бұрын
So nice of you
@bernardwilliams9499
@bernardwilliams9499 Жыл бұрын
Thanks a lot
@dbestech
@dbestech Жыл бұрын
Most welcome
@user-se5ci5er2e
@user-se5ci5er2e 2 жыл бұрын
السلام عليكم أخي There is a topic I searched a lot about, and no explanation for it. Which is to receive and display notifications to users via the rest api. All explanations talk about firebase or local notifications. I hope you will give an explanation on this topic. Thank you
@dbestech
@dbestech 2 жыл бұрын
My food app tutorial wiil cover this.
@user-se5ci5er2e
@user-se5ci5er2e 2 жыл бұрын
@@dbestech I'm so happy to hear this I'm going to watch it. بإذن الله
@ai_malllu
@ai_malllu 2 жыл бұрын
Great.stuff. ❤ please create a video with local db like hive
@dbestech
@dbestech 2 жыл бұрын
Will try
@nani-xi7yk
@nani-xi7yk Жыл бұрын
I have used "Consumer(builder: (context, value, child)" instead of "final movie = Provider.of(context);" Is that Okay? What is the best way to use it?
@dbestech
@dbestech Жыл бұрын
It’s the way to use
@steev910
@steev910 2 жыл бұрын
thanks bro, I have asked you a question about best emulator except genymotion ??
@dbestech
@dbestech 2 жыл бұрын
I don't use android emulator much. I run iOS.
@nullcodeer
@nullcodeer 2 жыл бұрын
nice sir
@dbestech
@dbestech 2 жыл бұрын
Keep watching
@mkhwanazicebo4448
@mkhwanazicebo4448 2 жыл бұрын
@dbestech, can you please make a step by step video like this one explaining crud methods of phpmyadmin and flutter. this is a great video but it only retrieves jason data from the web, can u plz make a video where u not only retrieve and display but also take input from flutter app and send it to web to manipulate phpmyadmin database plz ?
@dbestech
@dbestech 2 жыл бұрын
yes coming this week
@victoraul1
@victoraul1 2 жыл бұрын
yes that would be great! thanks!
@mkhwanazicebo4448
@mkhwanazicebo4448 2 жыл бұрын
@@dbestech nice, looking foward to it
@TheAbhidugar
@TheAbhidugar 2 жыл бұрын
In provider we do not get any initialization method where we can call or request api. But in Getx there is a onInit method with which we can easily do the same things. With that we get the advantage of using stateless widget which was not otherwise possible.
@dbestech
@dbestech 2 жыл бұрын
Yes, Getx rocks. So more people are coming to Getx
@TheAbhidugar
@TheAbhidugar 2 жыл бұрын
@@dbestech But I have seen many developers saying not to use Getx as it is not well maintained library. Just google and you will find many tweets regarding this. What's your take on this? Let me know.
@dbestech
@dbestech 2 жыл бұрын
@@TheAbhidugar Getx is really very poplar. That’s means more people hate it. When it comes efficiency and rapid development Getx is the best choice. If you wanna learn more about flutter itself and deep understanding then learn Bloc
@TheAbhidugar
@TheAbhidugar 2 жыл бұрын
@@dbestech yeah that's true. I have learnt using getx from you thank you so much for that. Can you please also make tutorials for Provider also as it is Google's recommend, and I am going start giving interviews now so it'll help me there also... Thank you...peace
@wdavis6254
@wdavis6254 2 жыл бұрын
Very helpful! How would you handle a post request?
@dbestech
@dbestech 2 жыл бұрын
Coming soon
@wdavis6254
@wdavis6254 2 жыл бұрын
@@dbestech Appreciated👍
@vibhor1386
@vibhor1386 2 жыл бұрын
hello sir, i have a question, i'm trying to figure out how can i make an app where different users can login and every user can save their app settings and favorite items inside a favorite list and also can save app settings like light mode and dark mode and much more and also shared across different screens in the app(similar to most modern apps like spotify, kindle, etc), i want this data to be different for each logged in user, can you please guide me a little regarding this?
@sfdsfdsgfgsfsgfsgfsgf2768
@sfdsfdsgfgsfsgfsgfsgf2768 2 жыл бұрын
You can use firebase
@Abhishek-fc7fy
@Abhishek-fc7fy 2 жыл бұрын
Hey, here's the approach I would suggest. First of all you have a big problem in front of you. Divide it into smaller ones. I'm assuming you'll work with databases here, I have experience with node js and it is actually easy to configure an API request to return a specific user's data back from the database. How that works is, because you have multiple users, you will need them to signin to their account and for that you'll need a way to authenticate each users. What an authentication logic does is, it tries to find a user who's trying to login by matching his/her credentials... This ends up with that user's identity/data. Using his id, you can fetch his data. This is one way of doing it. The app settings, can be saved locally using sharedpreferences. Or if you want them to sync with other devices then your database could have a separate collection/table for those settings. Data for different users will be different as you assign unique ids to the users. I feel that you should invest some time learning how to work with database and their response... Light and dark mode can be easily toggled using a switch and which switches between brightness.dark and brightness.light. And for favourite items, you should search for KZbin videos which show implementing the favourite logic that you need... Just understanding how that logic is implemented should be enough for you to implement it in your project.
@dbestech
@dbestech 2 жыл бұрын
lot of the work, step by step. I see someone already answered your question.
@vibhor691
@vibhor691 2 жыл бұрын
@@Abhishek-fc7fy thanks for such a detailed answer, i really appreciate it
@vibhor691
@vibhor691 2 жыл бұрын
@@dbestech yes , should i start learning js and node js or laravel for backend to achieve this? I don't know either of these but i know oop concepts from dart. And also which database?
@darcifo2463
@darcifo2463 2 жыл бұрын
Hi, my model contain a ObjectId type. It gives me an error "type 'String' is not a subtype of type 'ObjectId'". I assume your code only store String type of data only. Do you have any idea on how I can solve this? I cannot convert the ObjectId to String or maybe I do it wrong. Maybe you can help me with this? Thanks!
@dbestech
@dbestech 2 жыл бұрын
If your model contains a nested model, of course, you need to modify my model class here. You need to call fromJson inside fromJson for the nested one.
@darcifo2463
@darcifo2463 2 жыл бұрын
@@dbestech Solved! Thanks!
@dbestech
@dbestech 2 жыл бұрын
@@darcifo2463 what was the problem though?
@darcifo2463
@darcifo2463 2 жыл бұрын
@@dbestech Error when a user model has a data type of ObjectId. Somehow, Flutter gave an error "type 'String' is not a subtype of type 'ObjectId'". So I think, I dont need to display ObjectId in my apps, so I remove it in my model.
@nalbur_
@nalbur_ Жыл бұрын
Good explanation thank you but there is a misunderstanding situation. İn this tutorial you have only one page and your state is readable from everywhere. İmagine you have three page you made and request and you get data state was busy there is a loading state successfully worked then you pushed yourself to second page then you get data one more time successfully and lastly you pushed yourself to the third page and you requested for data your state changed to busy you're showing loading widget right now something happened on server when you popped to second page, second page is also shows loading widget but it wouldn't show that you popped one more time and on the first page it's also showing loading widget too. Because your state is waiting response from third page to change. İn this situation you can't go to third page because your widgets (button for example) is not visible. You have only one chance restart application. For prevent this issue use singleton and create state for every page. When you pop third page's state is busy but others are not. Also third page state changed to initial (idle,free) state, too.
@dbestech
@dbestech Жыл бұрын
You are most welcome. I will look into issues.
@sandeepraju2403
@sandeepraju2403 2 жыл бұрын
tqsm now im able to get single api, then what about if there is a list of api
@dbestech
@dbestech 2 жыл бұрын
You can request multiple api with GraphQL
@saqibnawaz3966
@saqibnawaz3966 Жыл бұрын
how can we apply the check if list comes from api is null for example homedata.homeModel?.data.recentbookings.isEmpty here the compiler shows an error .
@dbestech
@dbestech Жыл бұрын
checking null is easy. list could be empty not, null
@saqibnawaz3966
@saqibnawaz3966 Жыл бұрын
@@dbestech yes how we can handle this empty issue
@dbestech
@dbestech Жыл бұрын
@@saqibnawaz3966 hard to see without code.
@meek6836
@meek6836 2 жыл бұрын
Atlast Provider.
@dbestech
@dbestech 2 жыл бұрын
This is my third provider.
@bhabhayt398
@bhabhayt398 2 жыл бұрын
Search data for database implement grid view sqlite
@dbestech
@dbestech 2 жыл бұрын
You need to wait few days before I make it
State Management! Flutter What's next? #1
23:01
Codrut Erdei
Рет қаралды 7 М.
Самое Романтичное Видео ❤️
00:16
Глеб Рандалайнен
Рет қаралды 6 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 90 МЛН
Каха и суп
00:39
К-Media
Рет қаралды 3,7 МЛН
API Call using Provider | Flutter State Management
11:26
Nitish Kumar Singh
Рет қаралды 19 М.
Flutter Provider EASY Tutorial
9:43
Flutter Mapp
Рет қаралды 43 М.
Flutter Provider - Advanced Firebase Data Management
11:08
Fireship
Рет қаралды 143 М.
Rest API - Best Practices - Design
15:50
High-Performance Programming
Рет қаралды 100 М.
REST Call with Flutter - Http methods
19:55
CodeX
Рет қаралды 68 М.
State Management Like A Pro - Flutter Riverpod
10:30
Robert Brunhage
Рет қаралды 75 М.
#Google Flutter - MVVM in Flutter using Providers.
34:34
Mobile Programmer
Рет қаралды 56 М.
Flutter Riverpod Beginner Tutorial With HTTP API Endpoints
25:10
THETA 360 Developers
Рет қаралды 4,4 М.
Как правильно выключать звук на телефоне?
0:17
Люди.Идеи, общественная организация
Рет қаралды 644 М.
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00
VA-PC
Рет қаралды 1,7 МЛН
Klavye İle Trafik Işığını Yönetmek #shorts
0:18
Osman Kabadayı
Рет қаралды 956 М.