import 'dart:convert'; import 'package:http/http.dart' as http; import 'package:wetter/models/daily_weather_model.dart'; class BrightSkyAPI { static Future 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=10&date=$dt&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'); } } }