Logo

Programming-Idioms

History of Idiom 45 > diff from v12 to v13

Edit summary for version 13 by :

Version 12

2015-08-23, 10:10:32

Version 13

2015-08-23, 10:10:53

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with next instructions.

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with next instructions.

Imports
import "dart:async";
Imports
import "dart:async";
Code
int compuation() async {
  // ... before ...
  await new Future.delayed(const Duration(seconds : 5));
  // ... after ...
}
Code
int compuation() async {
  // ... before ...
  await new Future.delayed(const Duration(seconds : 5));
  // ... after ...
}
Comments bubble
Waiting only makes sense in asynchronous code. It's not done that often, and there is no simple primitive for it.
Comments bubble
Waiting makes sense in asynchronous code. It's not done that often, and there is no simple primitive for it.