parseDurationFromSeconds static method
Parses a duration from seconds. The value
may be an int, double, or
number encoded String. If the value
cannot be processed into a
duration then this will return the defaultValue
.
Implementation
static Duration? parseDurationFromSeconds(
dynamic value, [
Duration? defaultValue,
]) {
final seconds = value is Duration ? value.inSeconds : parseInt(value);
return seconds == null ? defaultValue : Duration(seconds: seconds);
}