Initial Commit

This commit is contained in:
Konstantin Kollar
2022-08-29 14:28:17 +02:00
commit e2e6cab479
129 changed files with 4516 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:wetter/models/daily_weather_model.dart';
class BrightSkyAPI {
static Future<DailyWeatherModel> fetchForecast() async {
final response = await http.get(
Uri.parse(
'https://api.brightsky.dev/weather?lat=53.43&lon=20&date=2022-08-30&tz=Europe/Berlin'),
headers: {"Accept": "application/json"});
if (response.statusCode == 200) {
return DailyWeatherModel.fromJson(jsonDecode(response.body));
} else {
throw Exception('Failed to load weather data');
}
}
}