sleep function Null safety

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

sleeps for the provided duration of the given interval.

sleep(2);

sleep(2, interval=Interval.minutes);

The interval defaults to seconds.

If the duration is 0 or less sleep returns immediately.

Implementation

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