parseHHColonMMToTimeOfDay static method
Parses a nullable HH:MM string to TimeOfDay.
Returns TimeOfDay(hour: 0, minute: 0) if hhColonMM is null or empty.
Implementation
static TimeOfDay parseHHColonMMToTimeOfDay(String? hhColonMM) {
if (hhColonMM == null || hhColonMM.isEmpty) {
return TimeOfDay(hour: 0, minute: 0);
}
String hh = hhColonMM.substring(0, hhColonMM.indexOf(':'));
String mm = hhColonMM.takeAfter(':');
return TimeOfDay(hour: int.parse(hh), minute: int.parse(mm));
}