isBetweenRange method

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

Checks if the current DateTime is within the specified range.

Args: range (DateTimeRange?): The range to check against. inclusive (bool): If true, the start and end dates of the range are included in the check. Defaults to true.

Returns: bool: True if the DateTime is within the range, false otherwise.

Implementation

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

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