Logo

Programming-Idioms

History of Idiom 45 > diff from v45 to v46

Edit summary for version 46 by kuef:
[Dart] Added warning, that the isolate stops completely, as this might some users not expect.

Version 45

2019-09-09, 09:01:38

Version 46

2019-09-13, 16:14:02

Idiom #45 Pause execution for 5 seconds

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

Illustration

Idiom #45 Pause execution for 5 seconds

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

Illustration
Imports
import 'dart:io';
Imports
import 'dart:io';
Code
sleep(const Duration(seconds: 5));
Code
sleep(const Duration(seconds: 5));
Comments bubble
sleep is only available if dart:io is available (ie. on server side)
Comments bubble
sleep is only available if dart:io is available (ie. on server side)

Attention! sleep stops all asynchronous execution within the whole Isolate, e.g. will stop all updates for the complete Flutter GUI for that time.
Doc URL
https://api.flutter.dev/flutter/dart-io/sleep.html