isDateWithInDateRange function

bool isDateWithInDateRange(
  1. dynamic startDate,
  2. dynamic endDate,
  3. dynamic date
)

Check the date in between first and last date

Implementation

bool isDateWithInDateRange(dynamic startDate, dynamic endDate, dynamic date) {
  if (startDate == null || endDate == null || date == null) {
    return false;
  }

  if (startDate.isAfter(endDate) == true) {
    final dynamic temp = startDate;
    startDate = endDate;
    endDate = temp;
  }

  if (isSameOrBeforeDate(endDate, date) && isSameOrAfterDate(startDate, date)) {
    return true;
  }

  return false;
}