isWithin method

bool isWithin(
  1. DateTime time
)

Implementation

bool isWithin(DateTime time) {
  var valid = (time.isAfter(start) || time.isAtSameMomentAs(start));
  if (end != null) {
    valid = valid && (time.isBefore(end!) || time.isAtSameMomentAs(end!));
  }
  return valid;
}