emojiDayOrNight property
String?
get
emojiDayOrNight
Returns TimeEmojiUtils.sunEmoji if the DateTime's hour is during daytime (7am inclusive to 6pm exclusive), otherwise returns TimeEmojiUtils.moonEmoji. otherwise returns TimeEmojiUtils.moonEmoji.
This is a convenient way to get the day/night emoji based on a DateTime instance.
Example:
DateTime now = DateTime.now();
String? emoji = now.emojiDayOrNight; // Returns '☀️' or '🌙' based on the current hour.
Implementation
String? get emojiDayOrNight => TimeEmojiUtils.getEmojiDayOrNight(hour);