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