isTimeOfDay static method

bool isTimeOfDay(
  1. String str
)

Implementation

static bool isTimeOfDay(String str) {
  try {
    final List<String> split = str.split(':');
    final int hour = int.parse(split[0]);
    final int minute = int.parse(split[1]);
    if (hour < 0 || hour > 23 || minute < 0 || minute > 59) return false;
    return true;
  } catch (e) {
    return false;
  }
}