Show temperature of today after starting app
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user