toTimeOfDay24 method

TimeOfDay toTimeOfDay24()

"14:30" → TimeOfDay (24-hour format) – most common & safest

Implementation

TimeOfDay toTimeOfDay24() {
  final parts = trim().split(':');
  if (parts.length < 2) throw FormatException('Invalid time format: $this');
  return TimeOfDay(
    hour: int.parse(parts[0]),
    minute: int.parse(parts[1].substring(0, 2)),
  );
}