### Install Apsl Sun Calc Flutter Package Source: https://github.com/appstonelabgit/apsl_sun_calc/blob/main/README.md Instructions for adding the flutter_suncalc package to your project's pubspec.yaml file and running the pub get command to install it. This is a prerequisite for using the package's functionalities. ```yaml dependencies: flutter_suncalc: ^0.0.1 ``` ```dart flutter pub get ``` -------------------------------- ### Install apsl_sun_calc Package Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt Instructions for adding the apsl_sun_calc package to your Flutter project's dependencies. This involves updating the pubspec.yaml file and running the Flutter package get command. ```yaml dependencies: apsl_sun_calc: ^0.0.4 ``` ```bash flutter pub get ``` -------------------------------- ### Calculate Sun Position using Apsl Sun Calc Source: https://github.com/appstonelabgit/apsl_sun_calc/blob/main/README.md Example of how to calculate the sun's position (azimuth and altitude) using the SunCalc.getSunPosition method. This function requires the current date and time, along with latitude and longitude coordinates. ```dart var sunPosition = SunCalc.getSunPosition(DateTime.now(), latitude, longitude); // Output the sun's position ``` -------------------------------- ### Calculate Moon Position using Apsl Sun Calc Source: https://github.com/appstonelabgit/apsl_sun_calc/blob/main/README.md Example of how to calculate the moon's position (azimuth, altitude, and distance) using the SunCalc.getMoonPosition method. This function requires the current date and time, along with latitude and longitude coordinates. ```dart var moonPosition = SunCalc.getMoonPosition(DateTime.now(), latitude, longitude); // Output the moon's position ``` -------------------------------- ### Add Custom Sun Times with SunCalc Dart Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt Demonstrates how to add custom solar angle thresholds for sunrise and sunset events using SunCalc.addTime. This function allows for specialized twilight definitions beyond the standard ones. It takes a solar angle, a start event name, and an end event name as parameters. ```dart import 'package:apsl_sun_calc/apsl_sun_calc.dart'; Future main() async { // Add custom sun time for "blue hour" (-4 degrees) SunCalc.addTime(-4, 'blueHourStart', 'blueHourEnd'); // Add custom sun time for civil aviation (-6.5 degrees) SunCalc.addTime(-6.5, 'aviationDawn', 'aviationDusk'); // Paris coordinates double latitude = 48.8566; double longitude = 2.3522; DateTime date = DateTime(2024, 9, 22); // Autumn equinox Map times = await SunCalc.getTimes(date, latitude, longitude); print('Custom Sun Times for Paris (September 22, 2024):'); print(' Blue Hour Start: ${times["blueHourStart"]}'); print(' Blue Hour End: ${times["blueHourEnd"]}'); print(' Aviation Dawn: ${times["aviationDawn"]}'); print(' Aviation Dusk: ${times["aviationDusk"]}'); print(''); print(' Standard Sunrise: ${times["sunrise"]}'); print(' Standard Sunset: ${times["sunset"]}'); // Output example: // Custom Sun Times for Paris (September 22, 2024): // Blue Hour Start: 2024-09-22 06:45:00.000 // Blue Hour End: 2024-09-22 19:15:00.000 // Aviation Dawn: 2024-09-22 06:35:00.000 // Aviation Dusk: 2024-09-22 19:25:00.000 // // Standard Sunrise: 2024-09-22 07:22:00.000 // Standard Sunset: 2024-09-22 19:28:00.000 } ``` -------------------------------- ### Import Apsl Sun Calc Package in Dart Source: https://github.com/appstonelabgit/apsl_sun_calc/blob/main/README.md Demonstrates how to import the flutter_suncalc package into your Dart code. This import statement is necessary to access the package's classes and methods for sun and moon calculations. ```dart import 'package:flutter_suncalc/flutter_suncalc.dart'; ``` -------------------------------- ### SunCalc.getMoonIllumination Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt Calculates the moon's illumination, including the illuminated fraction, phase, and angle. ```APIDOC ## SunCalc.getMoonIllumination ### Description Returns moon illumination data including the fraction of the moon's surface that is illuminated (0 to 1), the moon phase (0 = new moon, 0.25 = first quarter, 0.5 = full moon, 0.75 = last quarter), and the angle of illumination. ### Method `static Map getMoonIllumination(DateTime date)` ### Endpoint N/A (This is a library function, not a REST endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart import 'package:apsl_sun_calc/apsl_sun_calc.dart'; void main() { DateTime date = DateTime(2024, 8, 19); // Near full moon Map illumination = SunCalc.getMoonIllumination(date); print('Moon Illumination for ${date.toString().split(' ')[0]}:'); print(' Fraction illuminated: ${(illumination["fraction"]! * 100).toStringAsFixed(1)}%'); print(' Phase: ${illumination["phase"]!.toStringAsFixed(3)}'); print(' Angle: ${illumination["angle"]!.toStringAsFixed(4)} radians'); } ``` ### Response #### Success Response Returns a Map containing: - **fraction** (num) - The fraction of the moon's surface illuminated (0.0 to 1.0). - **phase** (num) - The moon phase, where 0.0 is new moon, 0.25 is first quarter, 0.5 is full moon, and 0.75 is last quarter. - **angle** (num) - The angle of illumination in radians. #### Response Example ```json { "fraction": 0.985, "phase": 0.485, "angle": -0.1234 } ``` ``` -------------------------------- ### Calculate Moon Illumination with SunCalc.getMoonIllumination Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt Calculates the moon's illumination, including the illuminated fraction, phase, and angle. This function is useful for determining the moon's appearance and phase on a specific date. It takes a DateTime object as input and returns a map containing illumination details. ```dart import 'package:apsl_sun_calc/apsl_sun_calc.dart'; void main() { DateTime date = DateTime(2024, 8, 19); // Near full moon Map illumination = SunCalc.getMoonIllumination(date); print('Moon Illumination for ${date.toString().split(' ')[0]}:'); print(' Fraction illuminated: ${(illumination["fraction"]! * 100).toStringAsFixed(1)}%'); print(' Phase: ${illumination["phase"]!.toStringAsFixed(3)}'); print(' Angle: ${illumination["angle"]!.toStringAsFixed(4)} radians'); // Determine moon phase name double phase = illumination["phase"]!.toDouble(); String phaseName; if (phase < 0.0625) { phaseName = 'New Moon'; } else if (phase < 0.1875) { phaseName = 'Waxing Crescent'; } else if (phase < 0.3125) { phaseName = 'First Quarter'; } else if (phase < 0.4375) { phaseName = 'Waxing Gibbous'; } else if (phase < 0.5625) { phaseName = 'Full Moon'; } else if (phase < 0.6875) { phaseName = 'Waning Gibbous'; } else if (phase < 0.8125) { phaseName = 'Last Quarter'; } else if (phase < 0.9375) { phaseName = 'Waning Crescent'; } else { phaseName = 'New Moon'; } print(' Phase name: $phaseName'); // Output example: // Moon Illumination for 2024-08-19: // Fraction illuminated: 98.5% // Phase: 0.485 // Angle: -0.1234 radians // Phase name: Full Moon } ``` -------------------------------- ### SunCalc.getTimes Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt Calculates various sun times including sunrise, sunset, dawn, dusk, golden hour, and nautical twilight for a given date and location. ```APIDOC ## GET /sun/times ### Description Returns a map of DateTime objects for various sun events including sunrise, sunset, dawn, dusk, golden hour, nautical twilight, and solar noon. This async method calculates all major solar phases for a given date and location. ### Method GET ### Endpoint /sun/times ### Parameters #### Query Parameters - **date** (DateTime) - Required - The date for which to calculate the sun times. - **latitude** (double) - Required - The latitude of the location. - **longitude** (double) - Required - The longitude of the location. ### Request Example ```dart import 'package:apsl_sun_calc/apsl_sun_calc.dart'; Future main() async { // New York City coordinates double latitude = 40.7128; double longitude = -74.0060; DateTime date = DateTime(2024, 6, 21); // Summer solstice Map times = await SunCalc.getTimes(date, latitude, longitude); print('Sun Times for New York City (June 21, 2024):'); print(' Solar Noon: ${times["solarNoon"]}'); print(' Nadir (lowest point): ${times["nadir"]}'); print(''); print(' Night End: ${times["nightEnd"]}'); print(' Nautical Dawn: ${times["nauticalDawn"]}'); print(' Dawn: ${times["dawn"]}'); print(' Sunrise: ${times["sunrise"]}'); print(' Sunrise End: ${times["sunriseEnd"]}'); print(' Golden Hour End: ${times["goldenHourEnd"]}'); print(''); print(' Golden Hour Start: ${times["goldenHour"]}'); print(' Sunset Start: ${times["sunsetStart"]}'); print(' Sunset: ${times["sunset"]}'); print(' Dusk: ${times["dusk"]}'); print(' Nautical Dusk: ${times["nauticalDusk"]}'); print(' Night: ${times["night"]}'); } ``` ### Response #### Success Response (200) - **solarNoon** (DateTime) - The time of solar noon. - **nadir** (DateTime) - The time when the sun is at its lowest point. - **nightEnd** (DateTime) - The end of the night. - **nauticalDawn** (DateTime) - The beginning of nautical dawn. - **dawn** (DateTime) - The beginning of dawn. - **sunrise** (DateTime) - The time of sunrise. - **sunriseEnd** (DateTime) - The end of sunrise. - **goldenHourEnd** (DateTime) - The end of the golden hour. - **goldenHour** (DateTime) - The start of the golden hour. - **sunsetStart** (DateTime) - The start of sunset. - **sunset** (DateTime) - The time of sunset. - **dusk** (DateTime) - The end of dusk. - **nauticalDusk** (DateTime) - The end of nautical dusk. - **night** (DateTime) - The beginning of night. #### Response Example ```json { "solarNoon": "2024-06-21T12:58:00.000Z", "nadir": "2024-06-21T00:58:00.000Z", "nightEnd": "2024-06-21T03:45:00.000Z", "nauticalDawn": "2024-06-21T04:28:00.000Z", "dawn": "2024-06-21T04:59:00.000Z", "sunrise": "2024-06-21T05:25:00.000Z", "sunriseEnd": "2024-06-21T05:28:00.000Z", "goldenHourEnd": "2024-06-21T06:03:00.000Z", "goldenHour": "2024-06-21T19:53:00.000Z", "sunsetStart": "2024-06-21T20:28:00.000Z", "sunset": "2024-06-21T20:31:00.000Z", "dusk": "2024-06-21T20:57:00.000Z", "nauticalDusk": "2024-06-21T21:28:00.000Z", "night": "2024-06-21T22:11:00.000Z" } ``` ``` -------------------------------- ### SunCalc.getMoonTimes Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt Calculates moonrise and moonset times for a given date and location. ```APIDOC ## SunCalc.getMoonTimes ### Description Returns moonrise and moonset times for a given date and location. Also indicates if the moon is always up or always down for that day (which can happen at extreme latitudes). The optional `inUtc` parameter controls whether calculations are done in UTC. ### Method `static Map getMoonTimes(DateTime date, double latitude, double longitude, [bool inUtc = false])` ### Endpoint N/A (This is a library function, not a REST endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart import 'package:apsl_sun_calc/apsl_sun_calc.dart'; void main() { // Sydney coordinates double latitude = -33.8688; double longitude = 151.2093; DateTime date = DateTime(2024, 7, 15); Map moonTimes = SunCalc.getMoonTimes(date, latitude, longitude, true); print('Moon Times for Sydney (July 15, 2024):'); if (moonTimes["rise"] != null) { print(' Moonrise: ${moonTimes["rise"]}'); } else { print(' Moonrise: No moonrise on this date'); } if (moonTimes["set"] != null) { print(' Moonset: ${moonTimes["set"]}'); } else { print(' Moonset: No moonset on this date'); } if (moonTimes["alwaysUp"] == true) { print(' Note: Moon is always above the horizon'); } if (moonTimes["alwaysDown"] == true) { print(' Note: Moon is always below the horizon'); } } ``` ### Response #### Success Response Returns a Map containing: - **rise** (DateTime?) - The time of moonrise, or null if there is no moonrise. - **set** (DateTime?) - The time of moonset, or null if there is no moonset. - **alwaysUp** (bool?) - True if the moon is always above the horizon on this date, otherwise null or false. - **alwaysDown** (bool?) - True if the moon is always below the horizon on this date, otherwise null or false. #### Response Example ```json { "rise": "2024-07-15T13:45:00.000Z", "set": "2024-07-16T02:30:00.000Z", "alwaysUp": false, "alwaysDown": false } ``` ``` -------------------------------- ### Flutter Widget for Sun and Moon Data with SunCalc Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt A comprehensive Flutter widget that integrates the SunCalc API to display real-time sun and moon positions, illumination, and key times like sunrise and sunset. It handles data fetching, state management, and UI rendering for a mobile application. Dependencies include the 'apsl_sun_calc' and 'flutter/material' packages. ```dart import 'package:apsl_sun_calc/apsl_sun_calc.dart'; import 'package:flutter/material.dart'; class SunMoonWidget extends StatefulWidget { const SunMoonWidget({Key? key}) : super(key: key); @override State createState() => _SunMoonWidgetState(); } class _SunMoonWidgetState extends State { Map? sunPosition; Map? moonPosition; Map? moonIllumination; Map? sunTimes; // London coordinates final double latitude = 51.5074; final double longitude = -0.1278; @override void initState() { super.initState(); _loadData(); } Future _loadData() async { final now = DateTime.now(); setState(() { sunPosition = SunCalc.getSunPosition(now, latitude, longitude); moonPosition = SunCalc.getMoonPosition(now, latitude, longitude); moonIllumination = SunCalc.getMoonIllumination(now); }); final times = await SunCalc.getTimes(now, latitude, longitude); setState(() { sunTimes = times; }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Sun & Moon Calculator')), body: Padding( padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('Location: London (${latitude}, ${longitude})'), const SizedBox(height: 16), if (sunPosition != null) ...[ Text('Sun Altitude: ${(sunPosition!["altitude"]! * 180 / 3.14159).toStringAsFixed(1)}°'), Text('Sun Azimuth: ${(sunPosition!["azimuth"]! * 180 / 3.14159).toStringAsFixed(1)}°'), ], const SizedBox(height: 16), if (sunTimes != null) ...[ Text('Sunrise: ${sunTimes!["sunrise"]}'), Text('Sunset: ${sunTimes!["sunset"]}'), Text('Solar Noon: ${sunTimes!["solarNoon"]}'), ], const SizedBox(height: 16), if (moonIllumination != null) ...[ Text('Moon Phase: ${(moonIllumination!["phase"]! * 100).toStringAsFixed(0)}%'), Text('Moon Illumination: ${(moonIllumination!["fraction"]! * 100).toStringAsFixed(0)}%'), ], const SizedBox(height: 16), ElevatedButton( onPressed: _loadData, child: const Text('Refresh'), ), ], ), ), ); } } ``` -------------------------------- ### Calculate Sun Times (Sunrise, Sunset, Twilight) - Dart Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt Calculates various sun event times, including sunrise, sunset, dawn, dusk, golden hour, nautical twilight, and solar noon for a specified date and location. This is an asynchronous method and requires the apsl_sun_calc package. ```dart import 'package:apsl_sun_calc/apsl_sun_calc.dart'; Future main() async { // New York City coordinates double latitude = 40.7128; double longitude = -74.0060; DateTime date = DateTime(2024, 6, 21); // Summer solstice Map times = await SunCalc.getTimes(date, latitude, longitude); print('Sun Times for New York City (June 21, 2024):'); print(' Solar Noon: ${times["solarNoon"]}'); print(' Nadir (lowest point): ${times["nadir"]}'); print(''); print(' Night End: ${times["nightEnd"]}'); print(' Nautical Dawn: ${times["nauticalDawn"]}'); print(' Dawn: ${times["dawn"]}'); print(' Sunrise: ${times["sunrise"]}'); print(' Sunrise End: ${times["sunriseEnd"]}'); print(' Golden Hour End: ${times["goldenHourEnd"]}'); print(''); print(' Golden Hour Start: ${times["goldenHour"]}'); print(' Sunset Start: ${times["sunsetStart"]}'); print(' Sunset: ${times["sunset"]}'); print(' Dusk: ${times["dusk"]}'); print(' Nautical Dusk: ${times["nauticalDusk"]}'); print(' Night: ${times["night"]}'); // Output example: // Sun Times for New York City (June 21, 2024): // Solar Noon: 2024-06-21 12:58:00.000 // Nadir (lowest point): 2024-06-21 00:58:00.000 // // Night End: 2024-06-21 03:45:00.000 // Nautical Dawn: 2024-06-21 04:28:00.000 // Dawn: 2024-06-21 04:59:00.000 // Sunrise: 2024-06-21 05:25:00.000 // Sunrise End: 2024-06-21 05:28:00.000 // Golden Hour End: 2024-06-21 06:03:00.000 // // Golden Hour Start: 2024-06-21 19:53:00.000 // Sunset Start: 2024-06-21 20:28:00.000 // Sunset: 2024-06-21 20:31:00.000 // Dusk: 2024-06-21 20:57:00.000 // Nautical Dusk: 2024-06-21 21:28:00.000 // Night: 2024-06-21 22:11:00.000 } ``` -------------------------------- ### Calculate Sun Position (Azimuth and Altitude) - Dart Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt Calculates the sun's azimuth and altitude in radians for a given date and geographic coordinates. The output can be converted to degrees for easier interpretation. Requires the apsl_sun_calc package. ```dart import 'package:apsl_sun_calc/apsl_sun_calc.dart'; void main() { // London coordinates double latitude = 51.5074; double longitude = -0.1278; DateTime now = DateTime.now(); Map sunPosition = SunCalc.getSunPosition(now, latitude, longitude); print('Sun Position:'); print(' Azimuth: ${sunPosition["azimuth"]} radians'); print(' Altitude: ${sunPosition["altitude"]} radians'); // Convert to degrees for readability double azimuthDegrees = (sunPosition["azimuth"]! * 180 / 3.14159); double altitudeDegrees = (sunPosition["altitude"]! * 180 / 3.14159); print(' Azimuth: ${azimuthDegrees.toStringAsFixed(2)} degrees'); print(' Altitude: ${altitudeDegrees.toStringAsFixed(2)} degrees'); // Output example: // Sun Position: // Azimuth: -0.523 radians // Altitude: 0.785 radians // Azimuth: -30.00 degrees // Altitude: 45.00 degrees } ``` -------------------------------- ### SunCalc.getMoonPosition Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt Calculates the moon's position, including azimuth, altitude, distance, and parallactic angle for a given date and location. ```APIDOC ## SunCalc.getMoonPosition ### Description Returns the moon's position including azimuth, altitude (corrected for atmospheric refraction), distance from Earth in kilometers, and parallactic angle. Useful for applications that need precise lunar positioning. ### Method `static Map getMoonPosition(DateTime date, double latitude, double longitude)` ### Endpoint N/A (This is a library function, not a REST endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```dart import 'package:apsl_sun_calc/apsl_sun_calc.dart'; void main() { // Tokyo coordinates double latitude = 35.6762; double longitude = 139.6503; DateTime now = DateTime.now(); Map moonPosition = SunCalc.getMoonPosition(now, latitude, longitude); print('Moon Position for Tokyo:'); print(' Azimuth: ${moonPosition["azimuth"]!.toStringAsFixed(4)} radians'); print(' Altitude: ${moonPosition["altitude"]!.toStringAsFixed(4)} radians'); print(' Distance: ${moonPosition["distance"]!.toStringAsFixed(0)} km'); print(' Parallactic Angle: ${moonPosition["parallacticAngle"]!.toStringAsFixed(4)} radians'); } ``` ### Response #### Success Response Returns a Map containing: - **azimuth** (num) - The moon's azimuth in radians. - **altitude** (num) - The moon's altitude in radians, corrected for atmospheric refraction. - **distance** (num) - The distance from Earth in kilometers. - **parallacticAngle** (num) - The parallactic angle in radians. #### Response Example ```json { "azimuth": 1.2345, "altitude": 0.5236, "distance": 384400, "parallacticAngle": 0.1234 } ``` ``` -------------------------------- ### Calculate Moon Times with SunCalc.getMoonTimes Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt Calculates the times for moonrise and moonset for a given date and location. It also indicates if the moon is perpetually visible or not visible on that day, which is relevant for extreme latitudes. The function accepts date, latitude, longitude, and an optional UTC flag, returning a map with rise and set times. ```dart import 'package:apsl_sun_calc/apsl_sun_calc.dart'; void main() { // Sydney coordinates double latitude = -33.8688; double longitude = 151.2093; DateTime date = DateTime(2024, 7, 15); Map moonTimes = SunCalc.getMoonTimes(date, latitude, longitude, true); print('Moon Times for Sydney (July 15, 2024):'); if (moonTimes["rise"] != null) { print(' Moonrise: ${moonTimes["rise"]}'); } else { print(' Moonrise: No moonrise on this date'); } if (moonTimes["set"] != null) { print(' Moonset: ${moonTimes["set"]}'); } else { print(' Moonset: No moonset on this date'); } if (moonTimes["alwaysUp"] == true) { print(' Note: Moon is always above the horizon'); } if (moonTimes["alwaysDown"] == true) { print(' Note: Moon is always below the horizon'); } // Output example: // Moon Times for Sydney (July 15, 2024): // Moonrise: 2024-07-15 13:45:00.000Z // Moonset: 2024-07-16 02:30:00.000Z } ``` -------------------------------- ### SunCalc.getSunPosition Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt Calculates the sun's current position, providing azimuth and altitude in radians for a given date and geographic coordinates. ```APIDOC ## GET /sun/position ### Description Calculates the sun's current position (azimuth and altitude in radians) for a given date and geographic coordinates. The azimuth is measured from south, clockwise (north = -PI, east = -PI/2, south = 0, west = PI/2). Altitude is the angle above the horizon. ### Method GET ### Endpoint /sun/position ### Parameters #### Query Parameters - **date** (DateTime) - Required - The date for which to calculate the sun's position. - **latitude** (double) - Required - The latitude of the location. - **longitude** (double) - Required - The longitude of the location. ### Request Example ```dart import 'package:apsl_sun_calc/apsl_sun_calc.dart'; void main() { // London coordinates double latitude = 51.5074; double longitude = -0.1278; DateTime now = DateTime.now(); Map sunPosition = SunCalc.getSunPosition(now, latitude, longitude); print('Sun Position:'); print(' Azimuth: ${sunPosition["azimuth"]} radians'); print(' Altitude: ${sunPosition["altitude"]} radians'); } ``` ### Response #### Success Response (200) - **azimuth** (num) - The sun's azimuth in radians. - **altitude** (num) - The sun's altitude in radians. #### Response Example ```json { "azimuth": -0.523, "altitude": 0.785 } ``` ``` -------------------------------- ### Calculate Moon Position with SunCalc.getMoonPosition Source: https://context7.com/appstonelabgit/apsl_sun_calc/llms.txt Calculates the moon's precise position, including azimuth, altitude, distance, and parallactic angle. This function is useful for applications requiring accurate lunar tracking. It takes the current date, latitude, and longitude as input and returns a map of celestial coordinates. ```dart import 'package:apsl_sun_calc/apsl_sun_calc.dart'; void main() { // Tokyo coordinates double latitude = 35.6762; double longitude = 139.6503; DateTime now = DateTime.now(); Map moonPosition = SunCalc.getMoonPosition(now, latitude, longitude); print('Moon Position for Tokyo:'); print(' Azimuth: ${moonPosition["azimuth"]!.toStringAsFixed(4)} radians'); print(' Altitude: ${moonPosition["altitude"]!.toStringAsFixed(4)} radians'); print(' Distance: ${moonPosition["distance"]!.toStringAsFixed(0)} km'); print(' Parallactic Angle: ${moonPosition["parallacticAngle"]!.toStringAsFixed(4)} radians'); // Convert altitude to degrees double altitudeDegrees = moonPosition["altitude"]! * 180 / 3.14159; print(' Altitude: ${altitudeDegrees.toStringAsFixed(2)} degrees above horizon'); // Check if moon is visible (above horizon) if (moonPosition["altitude"]! > 0) { print(' Status: Moon is visible above the horizon'); } else { print(' Status: Moon is below the horizon'); } // Output example: // Moon Position for Tokyo: // Azimuth: 1.2345 radians // Altitude: 0.5236 radians // Distance: 384400 km // Parallactic Angle: 0.1234 radians // Altitude: 30.00 degrees above horizon // Status: Moon is visible above the horizon } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.