isBetween method

bool isBetween(
  1. {int year,
  2. int month,
  3. DateTime lower,
  4. DateTime upper}
)

Returns true if year and month is not older than lower (or lower=null) and not younger than upper (or upper=null).

Implementation

static bool isBetween({int year, int month, DateTime lower, DateTime upper}) {
  if ((lower != null) &&
      ((year < lower.year) || (year == lower.year && month < lower.month))) {
    return false;
  }
  if ((upper != null) &&
      ((year > upper.year) || (year == upper.year && month > upper.month))) {
    return false;
  }
  return true;
}