neursh / open-meteo-dart

A simple, fast, asynchronous Dart/Flutter client package for Open-Meteo weather APIs.
https://pub.dev/packages/open_meteo
MIT License
5 stars 3 forks source link

Sunrise & Sunset do not work #14

Closed YarosMallorca closed 2 months ago

YarosMallorca commented 2 months ago

Minimal repro code:

import 'package:open_meteo/open_meteo.dart';

void main() async {
  final weather = WeatherApi();
  final response = await weather.request(
    latitude: 52.52,
    longitude: 13.41,
    startDate: DateTime.now(),
    endDate: DateTime.now().add(Duration(days: 1)),
    daily: {WeatherDaily.sunrise},
  );

  print(response.dailyData[WeatherDaily.sunrise]?.values);
}

In the console this prints:

{}
neursh commented 2 months ago

I got it, this is an oversight in the package, it only collects the double values type and ignores int type that is present in WeatherDaily.sunrise for example. I'm going to fix it.

Thanks for reporting this issue!

neursh commented 2 months ago

This issue now fixed in 2.0.1!

{
  2024-08-12 05:00:00.000: 1723434297,
  2024-08-13 05:00:00.000: 1723520797
}