isBetween method
Returns true if this DateTime is between start and end.
If isInclusive is true (default), start and end are included
in the check. If false, only dates strictly between them match.
Implementation
@useResult
bool isBetween(DateTime start, DateTime end, {bool isInclusive = true}) {
if (isInclusive) {
return (isAfter(start) || isAtSameMomentAs(start)) &&
(isBefore(end) || isAtSameMomentAs(end));
}
return isAfter(start) && isBefore(end);
}