validate method
Implementation
@override
void validate() {
assert(
end != null || duration != null,
"Must supply either [end] or [duration]",
);
if (end != null) {
assert(
end!.isBefore(start) || end!.isAtSameMomentAs(start),
"[end] must be after [start]",
);
}
if (duration != null) {
assert(duration!.isNegative, "[duration] cannot be negative");
}
super.validate();
}