isNowInRange method

bool isNowInRange({
  1. DateTime? now,
})

Checks if the current date and time is within the range

NOTE: you can't really make date optional, even if looking for now because of microsecond precision. So just cache DateTime.now() and pass it in.

Returns true if the current date and time is within the range

Implementation

bool isNowInRange({DateTime? now}) {
  now ??= DateTime.now();

  return inRange(now);
}