cDelay method

Future cDelay([
  1. FutureOr callback()?
])

Delays the execution of a callback or code by the specified number of seconds.

Usage:

void main() {
  2.delay(() {
    // Code to be executed after a 2-second delay.
  });
}

Implementation

Future cDelay([FutureOr Function()? callback]) async => Future.delayed(
      Duration(
        milliseconds: (this * 1000).round(),
      ),
      callback,
    );