sunrise_sunset 1.0.4

Flutter Android iOS web

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);
  }
}
0
likes
100
pub points
64%
popularity

Publisher

aeyrium.com

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

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL 3.0 (LICENSE)

Dependencies

flutter, http

More

Packages that depend on sunrise_sunset