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.
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;