sunrise_sunset 1.0.4 copy "sunrise_sunset: ^1.0.4" to clipboard
sunrise_sunset: ^1.0.4 copied to clipboard

Dart API that provides sunset and sunrise times for a given latitude and longitude

example/lib/main.dart

import 'package:sunrise_sunset/sunrise_sunset.dart';

void main() async {
  try {
    final response = await SunriseSunset.getResults(
        latitude: 39.001735, longitude: -119.752744);

    if (response.success) {
      print('Sunrise: ${response.data.sunrise}');
      print('Sunset: ${response.data.sunset}');
      print('Solar Noon: ${response.data.solarNoon}');
      print('Day Length: ${response.data.dayLength}');
      print('Civil Twilight Start: ${response.data.civilTwilightBegin}');
      print('Civil Twilight End: ${response.data.civilTwilightEnd}');
      print('Nautical Twilight Start: ${response.data.nauticalTwilightBegin}');
      print('Nautical Twilight End: ${response.data.nauticalTwilightEnd}');
      print(
          'Astronomical Twilight Start: ${response.data.astronomicalTwilightBegin}');
      print(
          'Astronomical Twilight End: ${response.data.astronomicalTwilightEnd}');
    } else {
      print(response.error);
    }
  } catch (err) {
    print("Failed to get data.");
    print(err);
  }
}
11
likes
40
points
42
downloads

Publisher

verified publisheraeyrium.com

Weekly Downloads

Dart API that provides sunset and sunrise times for a given latitude and longitude

Homepage
Repository (GitHub)
View/report issues

License

GPL-3.0 (license)

Dependencies

flutter, http

More

Packages that depend on sunrise_sunset