Skip to content

Instantly share code, notes, and snippets.

@tauheed0007
Created March 29, 2022 09:36
Show Gist options
  • Save tauheed0007/c4c7d46fee73b817e573dafa1518b07d to your computer and use it in GitHub Desktop.
Save tauheed0007/c4c7d46fee73b817e573dafa1518b07d to your computer and use it in GitHub Desktop.
by this method we can easily get data from api because now we also have to parse the link with Uri
import 'package:http/http.dart';.
//dependency
http: ^0.13.4
void getData() async {
//var url = Uri.parse("https://samples.openweathermap.org/data/2.5/weather?q=London&mode=html&appid=b6907d289e10d714a6e88b30761fae22");
// http.Response response = await http.get(url);
Response response = await get(Uri.parse('https://samples.openweathermap.org/data/2.5/weather?q=London&mode=html&appid=b6907d289e10d714a6e88b30761fae22'));
//http.Response response = await http.get(url);
print(response);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment