operator - method
Subtracts a Duration, Time, or int (ms) from the current instance, returning a new Time instance.
The behavior of the operator depends on the type of other:
- If
otherisnull, the current instance is returned. - If
otheris anint, it is interpreted as milliseconds and is subtracted from the current instance. - If
otheris a Time or Duration instance, it is subtracted from the current instance.
Throws:
- A StateError if
otheris notnull,Time,int, orDuration.
Implementation
Time operator -(Object? other) {
if (other == null) return this;
var offset = _toOffsetDuration(other);
if (offset.inMicroseconds == 0) return this;
return (asDuration - offset).toTime();
}