minDuration function

Duration minDuration(
  1. Duration a,
  2. Duration b
)

Returns the minimum of two Duration values.

Parameters

  • a - The first duration.
  • b - The second duration.

Returns

The shorter of the two durations.

Example

final shorter = minDuration(
  Duration(milliseconds: 100),
  Duration(milliseconds: 200),
); // Duration(milliseconds: 100)

Implementation

Duration minDuration(Duration a, Duration b) {
  return a < b ? a : b;
}