isBetweenRange method

  1. @useResult
bool isBetweenRange(
  1. DateTimeRange<DateTime>? range, {
  2. bool isInclusive = true,
})

Returns true if this DateTime is within the specified range, false if range is null.

If isInclusive is true (default), the start and end dates of the range are included in the check (closed interval). If false, only dates strictly between start and end are considered in range (open interval).

Implementation

@useResult
bool isBetweenRange(DateTimeRange? range, {bool isInclusive = true}) {
  if (range == null) {
    return false;
  }

  return isBetween(range.start, range.end, isInclusive: isInclusive);
}