Fetching Data from API | Part - 2 | HTTP get Request in Flutter | Hindi
Vložit
- čas přidán 29. 08. 2024
- To fetch data from an API in a Flutter app, you can use the http package, which provides a simple and efficient way to make HTTP requests and receive HTTP responses.
Here is an example of how you might use the http package to fetch data from an API in a Flutter app:
import 'package:http/http.dart' as http;
// Make a GET request to the API
final response = await http.get('example.com/ap...
// Check the status code of the response
if (response.statusCode == 200) {
// If the request was successful, parse the JSON data
final data = json.decode(response.body);
// Use the data as needed
} else {
// If the request was unsuccessful, throw an error
throw Exception('Failed to fetch data');
}
In this example, the http.get function is used to make a GET request to the API, and the response object is used to hold the response from the server. The statusCode property of the response object is used to check whether the request was successful or not, and the body property is used to hold the data returned by the server.
You can also use the http package to make other types of HTTP requests, such as POST, PUT, and DELETE, by using the http.post, http.put, and http.delete functions, respectively.
Blog: www.ahirlog.co...
My CZcams Gear:
Boya BYM1(Mic): amzn.to/3bvm69j
Redmi Note 7 Pro(Mic & Camera): amzn.to/3uRkVsb
MSI Motherboard: amzn.to/3fiQHYO
Intel i3 Processor: amzn.to/3w8TWbQ
Mouse: amzn.to/3yb8PMP
Keyboard: amzn.to/3bvmtkd
Wifi Adaptor: amzn.to/3fiQYuO
SSD: amzn.to/3w2w2Pa
Speakers: amzn.to/3w6pKhv
Instagram: / ahirlog
Facebook: / ahirlog
Twitter: / ahirlog
CZcams: / ahirlog
#ahirlog #flutter #dart
Last Summer by Ikson: / ikson
Music promoted by Audio Library • Last Summer - Ikson (N...
The way of your explaination, was really great as usual. Thanks a lot brother.
great video bro i got errors in my code but after watching this video .I have solve errors in my code thanks you bro .
Thank you
My friend Axit kapadiya is only depended on your you tube channel
hmm you are right
javadey loda (tu youtube karato ho atale badha no karata hoy ky
hello bhai,
thanks for this video the way of explaining is very easy to understanding and good and expecting more API's like post, put patch method. it's really appreciate thanks.
brother very good for beginners
Plz make a view of API Post Method ....Boht acha samjty ho bhai ap ...Love from Pakistan
Thank you
@@ahirlog plz Brother Api k Post b karwa do..plz
@@ahirlog agr ap ny already video upload ki hoi hye to Mujy link day do ma dakh leta hu
I will make
yeh same apan Provider se bhi kar sakte hai instead of listviewbuilder
right?
thank you very much ahirlog this video
Thank you too
exact the same code but circle is rotation all the time
Nice video thankyou 🙏🏼
Thank you too
Please bring State Management course
please make a video on post and put and delete method of http for api
ok
hey bro i found this error while fetching data, will you please help me to fix this error
_TypeError (type '_InternalLinkedHashMap' is not a subtype of type 'Iterable')
Use type cast as List or use .toList
@@ahirlog can you please explain where should I add .toList
how to add webview inside a button .
when i click that button it open webview
Ok
Thanku bhai
Type error string dynamic is not a sub type of type itrable bro pls solve
Use .tolist or type cast
Iam getting errors In home_page.dart,how can i modifying
here you are showing data from jsonarray, please can you help me to get jsonobject from api by button click and show in text widget ?
ok
ty
It's http or api
Post api ki video bana dijiye
ok
how to upload images
will upload
bhai aawaj kam h thodi
I want to fetch questions an answers from stackoverflow could you please guide
I am not sure about stack overflow, but I think if they provide api for then you use that api and fetch the data
SIr aapka contact detail share karo na
i need some help
What
how to fetch nested api its difficult bro please reply
make a video on this
bhai awaaz badhao sunai he nahi deti aap ki awaaz
Ok
Use headphone
Vdo quality is poor
Now you can check
http pakage ki jagh dio use karna kesa haiiiii....
You can use it
Type error string dynamic is not a sub type of type itrable bro pls solve
I will make video on this