isBefore method

bool isBefore(
  1. TimeOfDay? toTime
)

Checks if the nullable TimeOfDay is before another TimeOfDay.

Returns true if the current TimeOfDay instance is earlier in time compared to toTime.

Returns false if either the current TimeOfDay instance or toTime is null.

Implementation

bool isBefore(TimeOfDay? toTime) {
  if (this == null || toTime == null) return false;
  if (this!.hour < toTime.hour) {
    return true;
  } else if (this!.hour == toTime.hour) {
    return this!.minute < toTime.minute;
  } else {
    return false;
  }
}