Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import 'dart:convert';
import 'package:http/http.dart';
class NetworkHelper {
String url;
final String api_key = '4f7b32dc58f4ac156caec77d106358f8';
// '${location.latitude}&lon=${location.longitude}&appid=$api_key'
Future<Map> fetchWeatherInfo() async {
Map weatherMap;
Response response = await get(url);
if (response.statusCode == 200) {
weatherMap = jsonDecode(response.body);
return weatherMap;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment