sleepAsync function

Future<void> sleepAsync(
  1. int duration, {
  2. Interval interval = Interval.seconds,
})

sleeps for the provided duration of the given interval.

sleepAsync(2);

sleepAsync(2, interval=Interval.minutes);

The interval defaults to seconds.

If the duration is 0 or less sleep returns immediately.

See: sleep

Implementation

Future<void> sleepAsync(int duration, {Interval interval = Interval.seconds}) =>
    _Sleep().sleepAsync(duration, interval: interval);