maybeTimeout method

Future<T> maybeTimeout(
  1. Duration? duration,
  2. FutureOr<T> onTimeout()
)

Implementation

Future<T> maybeTimeout(Duration? duration, FutureOr<T> onTimeout()) {
  if (duration == null) return this;
  if (duration.inMicroseconds <= 0) return this;
  return this.timeout(duration, onTimeout: onTimeout);
}