toDurationWithDefault static method
Converts value into Date or returns default when conversion is not possible.
value
the value to convert.- defaultValue the default value. Returns Date value or default when conversion is not supported.
Implementation
static Duration toDurationWithDefault(value, Duration defaultValue) {
var result = DurationConverter.toNullableDuration(value);
return result ?? defaultValue;
}