closeTo method
Close to another Time
delta
The maximum seconds of which the two values may differ.
Default delta is Duration(seconds: 1)
Implementation
bool closeTo(
Time anotherTime, {
Duration delta = const Duration(seconds: 1),
}) {
final anotherTimeTotalSeconds = anotherTime.inSeconds;
final deltaSeconds = delta.inSeconds;
var diff = anotherTimeTotalSeconds - inSeconds;
if (diff < 0) {
diff = -diff;
}
final isClose = diff <= deltaSeconds;
return isClose;
}