difference method

Duration difference(
  1. TimeOfDay other
)

Returns a Duration with the difference when subtracting other from this.

The returned Duration will be negative if other occurs after this.

Implementation

Duration difference(TimeOfDay other) =>
    DateTime(2021, 1, 1, hour, minute, second).difference(
        DateTime(2021, 1, 1, other.hour, other.minute, other.second));