sleep function

void sleep(
  1. int duration, {
  2. Interval interval = Interval.seconds,
})

sleeps for the provided duration of the given interval.

WARINING: call this function will stop all async code from running. This is a change from 3.x and previous version of dcli. Use sleepAsync if you need async code to keep running.

sleep(2);

sleep(2, interval=Interval.minutes);

The interval defaults to seconds.

If the duration is 0 or less sleep returns immediately.

See: sleepAsync

Implementation

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