No video

Get data from Api in flutter - HTTP Requests in flutter

  Рет қаралды 136,827

Flutter With Me

Flutter With Me

Күн бұрын

In this video we will see how we can get data from API and upload that in our list.
This video will be first part of the series where we will learn how to handle http requests in flutter.
In the next video we will be covering on how to post request through the same principles.
Let me know in comments how you find this tutorial and also any changes that you would like me to make on the same.

Пікірлер: 190
@nuur6019
@nuur6019 2 жыл бұрын
if you have problems with the data.length; fix it with putting 'AsyncSnapshot' before snapshot in the builder parameter; builder: (context, AsyncSnapshot snapshot)
@clinihard847
@clinihard847 2 жыл бұрын
Thank you, my friend! You saved me!!!
@abhishekdeshpande8256
@abhishekdeshpande8256 2 жыл бұрын
Thank Buddy
@jeroenwolff
@jeroenwolff 2 жыл бұрын
Thanks, can you explain why? because snapshot is allready a AsyncSnapshot? or not?
@adityamore7471
@adityamore7471 2 жыл бұрын
thanks bro
@huzaifaahmad63
@huzaifaahmad63 2 жыл бұрын
Thanks Buddy.............!
@roohomecom8345
@roohomecom8345 2 жыл бұрын
Thank you for your tutorial. It really helps me, find a lot but most of them not working with flutter 2022. Containing many bugs. One bug to fix, is to add AsyncSnapshot before snapshot "builder: (context,AsyncSnapshot snapshot)" Anyway, I have just subscribe to your channel.
@minerva8658
@minerva8658 2 жыл бұрын
bro you are great
@mdxenon4749
@mdxenon4749 2 жыл бұрын
dude, u Legend
@velinfo7745
@velinfo7745 Жыл бұрын
Super Bro😃😃 Thank You
@nishantj1685
@nishantj1685 3 жыл бұрын
It would be really helpful if the code was available in text on medium or git. Nice work by the way.
@bensosfrequents
@bensosfrequents Жыл бұрын
This tutorial ignores two important things that video makers keeps ignorering all the times. (1) Showing an error if network is not available. (2) Detecting if returned Map(data) is empty and show "not data text" or something and probably showing a loading spinner for the slow networks instead of keeping users waiting on a blank screen, but loading spinner isn't important. Anyways it was a great tutorial. Many thanks
@vicsystems
@vicsystems 3 жыл бұрын
there are alot of explanations I have watched, but yours really helped me.
@my_wave_app
@my_wave_app 2 ай бұрын
thanks for this tutorial video it really helped me to build my mobile app, (analytics dashboard for social media content creator) which is now live! it has been few days only but this video was very helpful! API was a bit trickier but could make it work :) cheers
@muhammadharis1923
@muhammadharis1923 3 жыл бұрын
really appreciated this is the first video in which i become cleared about the concept of api and how to work with it
@anandrago6826
@anandrago6826 3 жыл бұрын
Last few days i try to know flutter api integration. so I watch lot of api integration videos on KZbin. but all the videos are uploaded minimum 4 month ago. So all my tried was failed i facing lot of error. finally I watch this video i see lot of different from that old videos. Thank you for this video.
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
I am glad it could help.
@ir2guru
@ir2guru 3 жыл бұрын
you just saved me from a terrible nightmares. Thanks a lot
@haeven6938
@haeven6938 Жыл бұрын
Yo!!! you just got a new subscriber, your lecture is suscint and clear. Wow!!! i love you sir. Keep up the good work. i'll definitly watch all your videos and drop feedbacks.
@danishshaikh1790
@danishshaikh1790 2 жыл бұрын
Very informative and helpful video. Love from PAKISTAN.
@muhmmadusmananwar2037
@muhmmadusmananwar2037 2 жыл бұрын
Amazing Huge Concept in less time Thank You Sir...!!!!!!
@xpwahab1
@xpwahab1 3 жыл бұрын
your teaching style is awesome. Sad to see you inactive
@thaaranyagandhi580
@thaaranyagandhi580 2 жыл бұрын
Thank you bro it's too easy and helpful, I saw most of the video but that's not clear and give more errors, but in this video is perfectly used, Thank you so much 🤝
@flutterwithme2530
@flutterwithme2530 2 жыл бұрын
Glad it helped
@mubeenulhaq8379
@mubeenulhaq8379 3 жыл бұрын
simple and easy method of teaching. thanks!
@sundar8601
@sundar8601 Жыл бұрын
Simplicity is your asset. Great!
@aleksandraweber4220
@aleksandraweber4220 Жыл бұрын
Hi :). I'm doing everything like you and here what happens: '_Map' is not a subtype of type 'Iterable' What am I doing wrong if you don't have this issue? I start to become powerless...
@karolcu2618
@karolcu2618 Жыл бұрын
you' are amazing! Thanks for the video
@hedayetulislam8211
@hedayetulislam8211 2 жыл бұрын
I think this code wouldn't work any more because of null safety
@MegaKuqi
@MegaKuqi 3 жыл бұрын
What is exactly datafromapi.iml ? this file is missing by me. That is maybe the reason why nothing shows in the console when I press the Button ?
@royalscart6613
@royalscart6613 3 жыл бұрын
I am facing the error on snapshot.data.length . Error Shows In The Property 'length' can't be unconditionly accessed because the receiver can be 'null',
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
Check if you have upgraded to null safety and update the code accordingly.
@debidattaray6646
@debidattaray6646 3 жыл бұрын
Sir please add some more content your style of teaching has clarity
@apurvabhalerao26
@apurvabhalerao26 2 жыл бұрын
Thank you soooo much sir for this video.. it is very helpful..
@pritishpattnaik4674
@pritishpattnaik4674 3 жыл бұрын
bro u literally solved my problem , thank you so much
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
Happy to help
@drew230
@drew230 2 жыл бұрын
I've been struggling with this. Instant sub
@BBFTW36
@BBFTW36 3 жыл бұрын
Ty so so much dude, especially for the Uri part.
@CHOTADONTHEGAMER
@CHOTADONTHEGAMER 3 жыл бұрын
Brother so here is the error The Getter length isnt defined and []. Isnt drfined for type OBJECT
@abhishekbali1069
@abhishekbali1069 2 жыл бұрын
After run this code I have faced some problems. Like.. 1.The method '[]' can't be unconditionally invoked because the receiver can be 'null. 2. The property 'length' can't be unconditionally accessed because the receiver can be 'null'. Please tell me what was the solution.
@NguyenQuangBDS9999
@NguyenQuangBDS9999 2 жыл бұрын
fix it with putting 'AsyncSnapshot' before snapshot in the builder parameter; builder: (context, AsyncSnapshot snapshot)
@LohithManideep
@LohithManideep 3 жыл бұрын
Bro I am getting this error (error: The operator '[]' isn't defined for the type 'Object'. ) did the same way as u. snapshot.data[i].country this is showing me error I've been trying this from 2 days help me out but while trying to print the data in for loop at 7:35 it is getting printed
@souravagarwal5785
@souravagarwal5785 2 жыл бұрын
I had the same problem so Someone on KZbin suggested that we should use (context, AsyncSnapshot snapshot) instead of (context, snapshot). And then I got the length with this snapshot.data!.length
@backyardfreestyler7866
@backyardfreestyler7866 2 жыл бұрын
You are really good
@codeinbantai5663
@codeinbantai5663 3 жыл бұрын
Very much thank You saved my day with the Uri fact
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
Glad it worked.
@araccount27
@araccount27 Жыл бұрын
But what if json data it self is non-string type ? i tried to use my boolean type json but it wont work
@akshayvilawadekar5266
@akshayvilawadekar5266 Жыл бұрын
The type 'Map' used in the 'for' loop must implement Iterable.
@SantoshYadav-lc3hi
@SantoshYadav-lc3hi 2 жыл бұрын
i like to way to explain it just amazing
@zahrayousefi9400
@zahrayousefi9400 3 жыл бұрын
simple and amazing. well done
@sumidsilva8912
@sumidsilva8912 3 жыл бұрын
I tried this code. But i am facing an error at snapshot.data.length Showing that - property length cannot be unconditionally accessed because the receiver can be null. Can u pls tell me hw to correct it.
@jeroenwolff
@jeroenwolff 2 жыл бұрын
Look at the answer of Nuur: if you have problems with the data.length; fix it with putting 'AsyncSnapshot' before snapshot in the builder parameter;
@theanh4843
@theanh4843 Жыл бұрын
flutter can enable or disable airplane mode on thirts with android. Thank you
@rhadityawahyu6690
@rhadityawahyu6690 3 жыл бұрын
thanks for the tutorial bro, but i have an error like this "The property 'length' can't be unconditionally accessed because the receiver can be 'null'. Try making the access conditional (using '?.') or adding a null check to the target ('!')." what should i do?
@senayudha2497
@senayudha2497 3 жыл бұрын
ubah sdk agan ke sdk: ">=2.7.0 < 3.0.0" nanti akan banyak sintax yg berubah seperti penggunaan required dan late akan di hilangkan
@khalidfaisal8999
@khalidfaisal8999 2 жыл бұрын
@@senayudha2497 Thanks, Bro I was stuck here since 4hrs
@ashikislam8370
@ashikislam8370 2 жыл бұрын
@@khalidfaisal8999 vai help me. kivabe sdk 2.7.0 anbo
@shariqali2827
@shariqali2827 2 жыл бұрын
same issue
@forme5794
@forme5794 2 жыл бұрын
I am new to flutter , so I don't know details. I am getting "the property length cannot be unconditionally accessed because the reciever can be null" error. Found no proper solution in online. How do I solve this?
@johnmungandi4413
@johnmungandi4413 Жыл бұрын
Thank you so much it's helpful 👍
@bougarytamega5059
@bougarytamega5059 2 жыл бұрын
thank you so much, it really helps me!
@chandrachaan3137
@chandrachaan3137 3 жыл бұрын
Well done ✅
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
Thanks
@manasasalapaka8436
@manasasalapaka8436 3 жыл бұрын
very nice explanation..would you please tell me how to add images?? thanks in advance
@arpitrahi5917
@arpitrahi5917 3 жыл бұрын
You did not tell how to fetch that address which was inside another jsonArray? tell us that too.
@SirHelios
@SirHelios 3 жыл бұрын
Thanks a lot - great tutorial!
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
You're welcome!
@TienLenTrinh
@TienLenTrinh 2 жыл бұрын
hey bro if api have Millions, hundreds of thousands of data, is it okay to use a for loop?
@musamdaka1606
@musamdaka1606 2 жыл бұрын
I have an error on class DataFromAPI extends statefulWidget how do you call that one to be fixed?
@alihyder7266
@alihyder7266 2 жыл бұрын
Sir please make a video on Flutter Integrate DataBase
@debidattaray6646
@debidattaray6646 3 жыл бұрын
Snapshot.data.length is not working in itemCount for ListView.builder
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
would ask you to check the code again, it's working absolutely fine. What is the error you get?
@MegaKuqi
@MegaKuqi 3 жыл бұрын
@@flutterwithme2530 when I press the Button it shows nothing in console, ?
@prabaljainn
@prabaljainn 3 жыл бұрын
i understood this video of yours but in my emulator its showing WAIT as i created if(snapshot.data == null) return container(child: Text('WAIT")) meaning My SNAPSHOT.data == null what the heck is the problem i cant understand
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
try changing it to !snapshot.hasdata
@marcellodeus
@marcellodeus 3 жыл бұрын
im doing the same as the video, but im reciving a error in snapshot.data.lenght: The property 'length' can't be unconditionally accessed because the receiver can be 'null'. Please, can someone help me?
@m.tuladharreddy8234
@m.tuladharreddy8234 2 жыл бұрын
Thank you so much it was sooo helpfull
@abdullamustafa2276
@abdullamustafa2276 Жыл бұрын
Thank You very match
@AndrewTSq
@AndrewTSq Жыл бұрын
in future videos, can you try to make the audio volume a bit better? I can hardly hear you even at high volume.
@sejalarora6923
@sejalarora6923 3 жыл бұрын
I'm still facing an error of "string' can't be assigned to the parameter type 'uri'" can you please help me out
@sejalarora6923
@sejalarora6923 3 жыл бұрын
@Ram eklesia thnkyou so much🤗
@volkankarakus8013
@volkankarakus8013 2 жыл бұрын
how can I fetch the addresses ? and i wanna save it in a list with map
@user-nf9sz6cy7l
@user-nf9sz6cy7l 2 жыл бұрын
Bro. If you can reply. Can you please tell us how to implement search and create a new page with the user details in it?
@prabaljainn
@prabaljainn 3 жыл бұрын
Literally helped me, thanks Dude
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
Glad I could help
@ibnualwi9784
@ibnualwi9784 2 жыл бұрын
sir, any chance we can fetch data from json using streambuilder ?
@snehanshubhattacharya228
@snehanshubhattacharya228 2 жыл бұрын
Hi! it keeps on saying loading data, please help, data doesn't load even after the api is called successfully
@sayededriss2394
@sayededriss2394 2 жыл бұрын
you forget to return the "users" from "getUserData" function.
@jovanemullings
@jovanemullings 3 жыл бұрын
so you would set the api key as the unencoded path ?
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
yes
@jovanemullings
@jovanemullings 3 жыл бұрын
@@flutterwithme2530 you can also use Uri.parse to use the full api url
@VQN_Code
@VQN_Code 2 жыл бұрын
how to get street in address in that link
@yeisonandrescaperamatoma9684
@yeisonandrescaperamatoma9684 2 жыл бұрын
I had a problem and it appears that it cannot be called because it is null
@thazeroword646
@thazeroword646 3 жыл бұрын
Very nice tutorial
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
Thanks for watching
@mikoajlech7958
@mikoajlech7958 2 жыл бұрын
@Flutter With Me Is there code on Github?
@nawfel1067
@nawfel1067 3 жыл бұрын
If you have error with snapshot.data.length just put sdk: ">=2.7.0 < 3.0.0"
@Benjay246
@Benjay246 3 жыл бұрын
In the pubspec.yaml? Just wondering what the code would look like
@uveshsiddiqui2477
@uveshsiddiqui2477 3 жыл бұрын
Thank you for solving my problem
@sudhanvahebbar1709
@sudhanvahebbar1709 3 жыл бұрын
thanks bro 👍
@shabnamnaseemahmed.5072
@shabnamnaseemahmed.5072 2 жыл бұрын
how we can add custom headers in http headers?
@yassineghadbane2319
@yassineghadbane2319 2 жыл бұрын
how to get the data of company and geo
@anandrago6826
@anandrago6826 3 жыл бұрын
I am facing error at itemCount: snapshot.data.length, anad title: Text(snapshot.data[i].name), Please help
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
What is the error you are getting?
@anandrago6826
@anandrago6826 3 жыл бұрын
@@flutterwithme2530 i change SDK 2.12.0 to SDK 2.7.0 now it's working Thank you for your reply.
@shohzodzet
@shohzodzet 2 жыл бұрын
Thank you very much.
@yassinabdulla368
@yassinabdulla368 2 жыл бұрын
thanks, it helped a lot
@GlobalSpotlight
@GlobalSpotlight 2 жыл бұрын
It keeps showing loading data.
@md.samiulhaque4411
@md.samiulhaque4411 3 жыл бұрын
getting an error in (snapshot.data.length). It's showing an error msg length can't be unconditionally accessed because the receiver can be null
@mrmusanda3576
@mrmusanda3576 3 жыл бұрын
me too did you fix it
@Sidiqtoha
@Sidiqtoha Жыл бұрын
how to get addreas ?
@priteshsapkale200
@priteshsapkale200 3 жыл бұрын
Username value can't be fetch ...rest working fine...plz others also do check...
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
You will need to write that code part to update username value which can then be returned.
@balamurugesan1838
@balamurugesan1838 3 жыл бұрын
Hi. why do we need to use FOR loop for iterating the values?
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
we are going to repeat it to fetch all the data as per the data from array we want. Hope this helps.
@tuankietngo650
@tuankietngo650 2 жыл бұрын
Do you have souce code this post ?
@JacoOlwagen
@JacoOlwagen 3 жыл бұрын
great! thank you
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
You are welcome!
@abhishekgiri1586
@abhishekgiri1586 2 жыл бұрын
In this you not show how to display address values? Please I request you to make a seperate video and teach us how to display address value?
@clinihard847
@clinihard847 2 жыл бұрын
Hello! Just put a subtitle in the "for": } else return ListView.builder( itemCount: snapshot.data.length, itemBuilder: (context, i) { return ListTile( title: Text(snapshot.data[i].nome), subtitle: Text(snapshot.data[i].endereco), ); });
@toshinenkosen9976
@toshinenkosen9976 2 жыл бұрын
Bravo !!!
@sridhargn1559
@sridhargn1559 2 жыл бұрын
Still, snapshot.data.length not resolved, Even i used the AsyncSnapshot.. Please tell me the solution if any.. it so thankful
@mdxenon4749
@mdxenon4749 2 жыл бұрын
replace builder with ->"builder: (context,AsyncSnapshot snapshot)"
@sanaboby5175
@sanaboby5175 3 жыл бұрын
i want to get address in human readable format current location user how please make video
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
Will definitely try to get a video for that up soon.
@StarBattle08
@StarBattle08 3 жыл бұрын
what if the data is xml?
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
Will try and get that video up soon asap.
@dev.faizan
@dev.faizan 2 жыл бұрын
great
@isha3851
@isha3851 3 жыл бұрын
Thank you very much for this tutorial. But i am facing issues with final keyword if i decalre a variable as final within a class and then creating a constructor just like you did then its showing me error and asking me to add required keyword in front of every final variable. example:- Class Users{ final email,username; Users(required this.email, required this.username); } i cant make parameter as optional what should i do?
@mohitgajjar8862
@mohitgajjar8862 3 жыл бұрын
give variable data types , use " final String email, username; "
@roc_kstark
@roc_kstark 3 жыл бұрын
master!!
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
Thanks!
@chemuhammadiqmalchemohamed2041
@chemuhammadiqmalchemohamed2041 2 жыл бұрын
Ty bosss
@coyoute2
@coyoute2 2 жыл бұрын
Nuur há 8 meses se você tiver problemas com o data.length; corrija-o colocando 'AsyncSnapshot' antes do snapshot no parâmetro do construtor; construtor: (contexto, instantâneo AsyncSnapshot) vlwww
@ggsap
@ggsap 2 жыл бұрын
Inverted commas?? They are called quotes
@marco_di
@marco_di 3 жыл бұрын
Realy awesome :-) what does the code snippet look like if the data is saved as locale json? A search box would also be great on this code base
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
Will get a video on that soon.
@marco_di
@marco_di 3 жыл бұрын
@@flutterwithme2530 I'm already looking forward to it :-)
@mahmudahmod3844
@mahmudahmod3844 2 жыл бұрын
Can you please make a flutter music app with how to fetch api and play music
@entertainmentzone8797
@entertainmentzone8797 2 жыл бұрын
thanks a lot bro
@omaryousifkamal4290
@omaryousifkamal4290 3 жыл бұрын
thank you sir!
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
You are welcome!
@xavieracaling6866
@xavieracaling6866 3 жыл бұрын
data.length can't be unconditionally accessed because the receiver can be null
@mrmusanda3576
@mrmusanda3576 3 жыл бұрын
did you fix the issue?
@xavieracaling6866
@xavieracaling6866 3 жыл бұрын
@@mrmusanda3576 yes i figured it out of my own code tho.. made my own line of code instead
@media.islamicityTV
@media.islamicityTV 2 жыл бұрын
0:00
@jabsdbaa7727
@jabsdbaa7727 2 жыл бұрын
thanks bro
@otukenn79
@otukenn79 3 жыл бұрын
How can we get divs inside of html tag
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
Could you clarify your question a bit more?
@otukenn79
@otukenn79 3 жыл бұрын
@@flutterwithme2530 I mean, I want to see between of tags
@TrustShare
@TrustShare 3 жыл бұрын
github?
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
didn't save the source code, will try and get that to you soon.
@alfonsoromero3092
@alfonsoromero3092 3 жыл бұрын
nice videos, thanks. How you can import images? thank again
@flutterwithme2530
@flutterwithme2530 3 жыл бұрын
Will create a video on that very soon.
@vathanachiem9879
@vathanachiem9879 Жыл бұрын
I have a problem with syntax Errorr : itemCount:snapshot.data.length, /// return ListView.builder( itemCount:snapshot.data.length, itemBuilder:(context,i){ return ListTile( title: Text(snapshot.data![i].fistname), ); /// Please help me
Http Post Method - Flutter || Post Data to API in flutter
17:32
Flutter With Me
Рет қаралды 37 М.
It's time for change, it's time for Linux.
10:53
DankPods
Рет қаралды 261 М.
OMG what happened??😳 filaretiki family✨ #social
01:00
Filaretiki
Рет қаралды 13 МЛН
WORLD'S SHORTEST WOMAN
00:58
Stokes Twins
Рет қаралды 210 МЛН
Pool Bed Prank By My Grandpa 😂 #funny
00:47
SKITS
Рет қаралды 20 МЛН
Matching Picture Challenge with Alfredo Larin's family! 👍
00:37
BigSchool
Рет қаралды 36 МЛН
REST Call with Flutter - Http methods
19:55
CodeX
Рет қаралды 70 М.
Display Data From a JSON in Flutter
7:11
Programming Addict
Рет қаралды 124 М.
Top 30 Flutter Tips and Tricks
6:50
Flutter Mapp
Рет қаралды 550 М.
FutureBuilder In Flutter - Building Lists with JSON Data
15:30
Samarth Agarwal
Рет қаралды 252 М.
A.I. ‐ Humanity's Final Invention?
18:30
Kurzgesagt – In a Nutshell
Рет қаралды 4,4 МЛН
microsoft doubles down on recording your screen
10:00
Low Level Learning
Рет қаралды 62 М.
You are using useFetch WRONG! (I hope you don't)
11:14
Alexander Lichter
Рет қаралды 26 М.
OMG what happened??😳 filaretiki family✨ #social
01:00
Filaretiki
Рет қаралды 13 МЛН