dart_suncalc 0.2.1 copy "dart_suncalc: ^0.2.1" to clipboard
dart_suncalc: ^0.2.1 copied to clipboard

A dart port of the suncalc library from https://github.com/mourner/suncalc

dart_suncalc #

A library to calculate sun and moon position and different solar and lunar times. This library is a refactoring of https://github.com/shanus/flutter_suncalc/. Which is a port from https://github.com/mourner/suncalc. The fix from https://github.com/jhsware/flutter_suncalc is included.

This code is based on the original Javascript suncalc by Vladimir Agafonkin ("mourner").

Usage Example #

import 'package:dart_suncalc/dart_suncalc.dart';

final date = new DateTime();

// get today's sunlight times for London
final times = SunCalc.getTimes(date, lat: 51.5, lng: -0.1);

// format sunrise time from the Date object
final sunriseStr = times.sunrise?.toLocal();

// get position of the sun (azimuth and altitude) at today's sunrise
final sunrisePos = SunCalc.getPosition(times.sunrise, lat: 51.5, lng: -0.1);

// get sunrise azimuth in degrees
final sunriseAzimuth = sunrisePos.azimuth * 180 / PI;
1
likes
140
pub points
74%
popularity

Publisher

verified publishergood-gui.de

A dart port of the suncalc library from https://github.com/mourner/suncalc

Homepage

Documentation

API reference

License

BSD-2-Clause (LICENSE)

More

Packages that depend on dart_suncalc