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:

// This will pause the execution for 1 second.
await Duration(seconds: 1).sleep;
print('Executed after 1 second pause');

Implementation

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