sunrise_sunset_api 1.0.0 copy "sunrise_sunset_api: ^1.0.0" to clipboard
sunrise_sunset_api: ^1.0.0 copied to clipboard

This is sa simple Rapper for the Sunrise-Sunset API written in Dart

example/main.dart

import 'package:sunrise_sunset_api/src/sunrise_sunset_response.dart';
import 'package:sunrise_sunset_api/sunrise_sunset_api.dart';

void main() async {
  // Use the SunriseSunset class to fetch data
  SunriseSunsetResponse? response = await SunriseSunset.getResults(
    date: DateTime.now().subtract(const Duration(days: 1)), // Yesterday's date
    latitude: 37.7749, // Latitude of San Francisco
    longitude: -122.4194, // Longitude of San Francisco
  );

  if (response != null) {
    print('Sunrise time: ${response.data?.sunrise}');
    print('Sunset time: ${response.data?.sunset}');
  } else {
    print('Failed to fetch data.');
  }
}
1
likes
130
pub points
19%
popularity

Publisher

verified publisherjunelee.fun

This is sa simple Rapper for the Sunrise-Sunset API written in Dart

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http

More

Packages that depend on sunrise_sunset_api