duration static method

int? duration(
  1. Duration? duration
)

Returns a double from the specified double.

Returns 0.0 if it's not a double.

This is useful in situations where null is not acceptable, for example, when providing a decoder to list. Otherwise, prefer using DataSource.v directly. Returns a Duration from the specified integer.

If it's not an integer, the default obtained from AnimationDefaults.durationOf is used (which is why a BuildContext is required).

Implementation

/// Returns a [Duration] from the specified integer.
///
/// If it's not an integer, the default obtained from
/// [AnimationDefaults.durationOf] is used (which is why a [BuildContext] is
/// required).
static int? duration(Duration? duration) {
  return duration?.inMilliseconds;
}