sleep property

Future<void> get sleep

A convenience getter that returns a Future<void> which completes after the current duration has elapsed.

This getter can be used to introduce a delay in the execution flow, effectively acting as a sleep function.

Example usage:

void main() async {
  // This will pause the execution for 1 second.
  await const Duration(seconds: 1).sleep;
}

Implementation

Future<void> get sleep => delayed<void>();