Show temperature of today after starting app

This commit is contained in:
Konstantin Kollar
2022-08-31 10:53:36 +02:00
parent e2e6cab479
commit bc3dcf575c
6 changed files with 107 additions and 6 deletions
+3 -2
View File
@@ -3,10 +3,11 @@ import 'package:http/http.dart' as http;
import 'package:wetter/models/daily_weather_model.dart';
class BrightSkyAPI {
static Future<DailyWeatherModel> fetchForecast() async {
static Future<DailyWeatherModel> fetchForecast(DateTime d) async {
String dt = "${d.year}-${d.month}-${d.day}";
final response = await http.get(
Uri.parse(
'https://api.brightsky.dev/weather?lat=53.43&lon=20&date=2022-08-30&tz=Europe/Berlin'),
'https://api.brightsky.dev/weather?lat=53.43&lon=10&date=$dt&tz=Europe/Berlin'),
headers: {"Accept": "application/json"});
if (response.statusCode == 200) {
return DailyWeatherModel.fromJson(jsonDecode(response.body));