wait function

Future wait(
  1. List args
)

Provides a wait() function that returns a Future that completes after the given number of milliseconds.

milliseconds int -> Future

Example

var future = wait(1000);
print("Future completed after 1 second.");

Implementation

Future wait(List args) {
  _arityCheck(1, args.length);
  _numberTypeCheck(args[0]);
  final ms = args[0] as num;
  return Future.delayed(Duration(milliseconds: ms.toInt()), () => ms);
}