durationGreaterThanZeroWithDefault function

Duration durationGreaterThanZeroWithDefault(
  1. Duration? value,
  2. Duration defaultValue
)

If value is null, or <=0, then return the default value.

Implementation

Duration durationGreaterThanZeroWithDefault(
    Duration? value, Duration defaultValue) {
  if (value == null || value.inMilliseconds <= 0) {
    return defaultValue;
  }
  return value;
}