MinutePeriod constructor
A class that implements a period type of a minute.
Implementation
MinutePeriod({required super.start, required super.end})
: assert(
end.difference(start) ==
const Duration(
seconds: 59,
milliseconds: 999,
microseconds: 999,
),
'The difference between start and end must be 59 seconds, 999 '
'milliseconds and 999 microseconds',
) {
const microsecond = Duration(microseconds: 1);
if (duration != const Duration(minutes: 1) ||
!start.isAtSameMinuteAs(end) ||
end.add(microsecond).isAtSameMinuteAs(start)) {
throw ArgumentError.value(
end,
'end',
'End must be at the same minute as start and must be the last '
'microsecond of the minute',
);
}
}