merge method

Timeout merge (
  1. Timeout other
)

Returns a new Timeout that merges this with other.

Timeout.none takes precedence over everything. If timeout is Timeout.none and other declares a duration, that takes precedence. Otherwise, this timeout's duration or factor are multiplied by other's factor.

Implementation

Timeout merge(Timeout other) {
  if (this == none || other == none) return none;
  if (other.duration != null) return Timeout(other.duration);
  if (duration != null) return Timeout(duration * other.scaleFactor);
  return Timeout.factor(scaleFactor * other.scaleFactor);
}