isBetween static method
Check if a date is between two other dates (inclusive)
Implementation
static bool isBetween(
DateTime date,
DateTime start,
DateTime end, {
bool inclusive = true,
}) {
if (inclusive) {
return (date.isAfter(start) || date.isAtSameMomentAs(start)) &&
(date.isBefore(end) || date.isAtSameMomentAs(end));
} else {
return date.isAfter(start) && date.isBefore(end);
}
}