FLUTTER ECOSYSTEM

bluefireteam/daylight

APIにアクセスせずに、地理的位置の日の出と日の入りの時刻を取得します。

日光 のプロジェクト画像
Stars
64
Forks
13
最終プッシュ(UTC)
2026/02/17
プロジェクト状態
公開中
Blue Fire GitHub avatar
GITHUB Organization

Blue Fire ↗

Team working on open source packages and plugins for Flutter, including Flame, Audioplayers, Photo View, and more.

言語Dart

使用している依存関係

依存関係一覧 5 件

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

README を開く / 閉じる

Daylight

Pub style: very good analysis License: MIT

Get the sunset and sunrise times for a geolocation without having to access any remote api.

This is a simple implementation of the legendary Sunset/Sunrise algorithm.

Installation 💻

❗ In order to start using Daylight you must have the Dart SDK installed on your machine.

Install it:

dart pub add daylight

Usage 📖

Check the API docs, example and tests for more information about how to use it.

import 'package:daylight/daylight.dart';


final berlin = DaylightLocation(52.518611, 13.408056);
final berlinCalculator = DaylightCalculator(berlin);
final dailyResults = berlinCalculator.calculateForDay(DateTime.now(), Zenith.astronomical);
print(dailyResults.sunrise); // Some UTC datetime with sunrise hours like 08:32
print(dailyResults.sunset);
print(dailyResults.type); // day type, will probably be sunriseAndSunset unless you live near the north pole or south pole


double eventHourEpoch = berlinCalculator.calculateEvent(DateTime.now(), Zenith.official, EventType.sunset);
print(DateTime.fromMillisecondsSinceEpoch(eventHourEpoch.floor()));