timeOfDayEmoji property

String timeOfDayEmoji

Time Of Day Emoji

Returns emoji of time of day in the format 🌤️, 🌤️, 🌙 or 🌙

Usage:

DateTime.now().timeOfDayEmoji

Result:

🌤️

Implementation

String get timeOfDayEmoji {
  if (hour >= 0 && hour < 12) {
    return '🌤️';
  } else if (hour >= 12 && hour < 16) {
    return '🌤️';
  } else if (hour >= 16 && hour < 20) {
    return '🌙';
  } else {
    return '🌙';
  }
}