isBetween method
Checks if the current DateTime instance falls between the provided fromDateTime and toDateTime.
Returns true if the current DateTime instance is after or equal to fromDateTime
and before or equal to toDateTime, otherwise returns false.
This method internally uses isAfterOrEqual and isBeforeOrEqual methods to determine if the current DateTime instance is within the specified range.
Implementation
bool isBetween(
DateTime fromDateTime,
DateTime toDateTime,
) {
final isAfter = isAfterOrEqual(fromDateTime);
final isBefore = isBeforeOrEqual(toDateTime);
return isAfter && isBefore;
}