Http Post Method - Flutter || Post Data to API in flutter
HTML-код
- Опубликовано: 23 ноя 2024
- In this video we will see how to use http post method in flutter.
Kindly go through the full video to get all the details of how this method works.
#flutter #Http # httpFlutter #flutterpost - Наука
you are literally the first ever video that worked from the first try without any bugs or error i have no idea what to say except thank you very much sir
i feel you bro.. me too :D
subs + 1
Video is useful but needs some changes like: you need to add json.encode() to body.
For example:
body: json.encode({
"test": "test"})
and add headers after the body, like:
headers: { 'Content-type': 'application/json',
'Accept': 'application/json'})
if you're having
"The body might complete normally, causing 'null' to be returned, but the return type, 'FutureOr', is a potentially non-nullable type."
error message, then you can change future type to Future and use it like a function returning bool value (after checking it's statusCode ofc.) And also don't forget to add "await" before calling the function.
Anyways, thanks for the video.
By the time you saw my message, this solution way may also been out dated.
Hi, I'm having the same issue.
The body might complete normally, causing 'null' to be returned, but the return type, 'FutureOr', is a potentially non-nullable type.
I am getting this error in future function method. Please Help
It is really a helpful lecture for understanding Please tell me the shortcut to wrap a widget inside a widget
Great video, you solved my problem thanxalot
Flutter task:
First Screen - Prepare a list using a api call
Second Screen - create another screen where u can fill the details related to list and write validations for fields.
And filled details should add to the first screen listings
When i create ModelClass.dart and then try to import it in main.dart file then it gives error as it does'nt import it to main class. And when we use it in inside the arguments of Future then it also does'nt accept it and give different errors on run time. So kindly tell me a solution of how to solve it.
Thank you so much. It worked and you explained it very well. :)
Sir you are picking something from there 10:06 what is this. Is it same for all. I am just confused with the thing you are working with outside of flutter!
after i put data how to show this data in next screen with name,job,id,create at please replay me.
What if I post blank . I mean null values in name and Job will it work?
Hi, I am new to dart and flutter, so I appreciate to you for this lecture.
I followed along your lecture it's exceptionally nice.
I've got two questions while following your lecture.
#1
at 13:34, you completed without returning for function submitData,
and there is underline for this. It's perfectly working without return dataModelFromJson(responseString);
and also it looks working with return dataModelFromJson(responseString);
by the looks of print(data)
Is there any reason you didn't add return for this?
#2
at 13:45, you initialized DataModel _dataModel;
I found out that _dataModel has underline and vs code shows that
M - 'The value of the field '_dataModel' isn't used. Try removing the field, or using it.
I was thinking like "okay, then I am gonna remove DataModel _dataModel; because it's not used", but if I remove DataModel _dataModel; , I got an error because I removed it that used to update value in setState!
so, I am confused with it.
it worked well my friend, thank you very much
You're welcome!
@@flutterwithme2530 pleasure.. i have another problem, for my project i was using the login api where i submit my email and password. the response body shows the user details(profile) which is a good thing but now i want to access the name and surname of the user from the JSON response body, so how do i do that??? please help
How do I populate data to the model after retrieving a data from an API?
Hi, what can I do if I have loads of form fields and a very huge JSON data? My request body will be flooded, for now I have given only 3 fields in the body like you, but my model has more than 50 fields and I need to post them all, one way to do this is by passing the entire json data in the body but i don't know how to do that exactly cause the code would look very bad with such huge amount of data in the body. Please help me!
You would need to pass the entire data if you need it all, there is no workaround to that.
Happy Coding!!
please make a video on put request
how to print the results in an alert instead of console ? please anyone tell me how to do this🤚
Plese can you make video for how to make login system using http post and the database is Postgres sql in flutter!
Already have a video for that.
ruclips.net/video/LGNKzfBmNmk/видео.html
@@flutterwithme2530 How could I do this with an api? I'm using django rest framework.
how "id" is created automatically ??
why you did not encode the body?
thanks it helped alot
How to show this data on anothe page as list flutter
pass it on to other pages using provider or setstate.
how to use it in localserver. Useing php and mysql
You will need to create API's using node or any other platform.
where is source ?
source githun url ????
Thank you!
Thank you
💜💜💜💜💜💜💜💜
WHERE IS THE SOURCE CODE??? WORTH TUTORIAL
Flutter task:
First Screen - Prepare a list using a api call
Second Screen - create another screen where u can fill the details related to list and write validations for fields.
And filled details should add to the first screen listings