astro_calculations is a Dart package for astronomical calculations. astro_calculations is inspired by Pysolar and based on this pdf by Ibrahim Reda and Afshin Andreas.
astro_calculations is currently a work in progress. It will soon support many more calculations.
SUNRISE TIME
By default all functions return DateTime object for UTC. To get it in Local format, pass isLocal as true.
final latitude = 28.6139;
final longitude = 77.2090;
final dateTime = DateTime.utc(2020, 12, 30);
final sunRiseTime =
getSunRiseTime(latitude, longitude, dateTime, isLocal: true);
SUNSET TIME
final sunSetTime =
getSunSetTime(latitude, longitude, dateTime, isLocal: true);
SUN TRANSIT TIME
final sunTransitTime =
getSunTransitTime(latitude, longitude, dateTime, isLocal: true);
AZIMUTH ANGLE OF SUN
final azimuthAngle =
getSunAzimuthAngle(latitude, longitude, elevation); //elevation is w.r.t. Sea level
void main() {
final latitude = 28.6139;
final longitude = 77.2090;
final dateTime = DateTime.utc(2020, 12, 30);
final sunRiseTime =
getSunRiseTime(latitude, longitude, dateTime, isLocal: true);
final sunSetTime =
getSunSetTime(latitude, longitude, dateTime, isLocal: true);
final sunTransitTime =
getSunTransitTime(latitude, longitude, dateTime, isLocal: true);
print('Sunrise Time: $sunRiseTime');
print('Sunset Time: $sunSetTime');
print('Sun Transit Time: $sunTransitTime');
}
OUTPUT
Sunrise Time: 2020-12-30 07:13:20.000
Sunset Time: 2020-12-30 17:34:16.000
Sun Transit Time: 2020-12-30 12:23:46.000
Created from templates made available by Stagehand under a BSD-style license.