duration static method

Duration duration(
  1. double? ms,
  2. Duration orElse
)

ms as a Duration, or orElse when the knob is unset — never below kMinEffectMs, so the result is always safe to drive an animation.

Implementation

static Duration duration(double? ms, Duration orElse) => animationSafe(
    ms == null ? orElse : Duration(milliseconds: ms.round()));