How can I “sleep” a Dart program

2019 edition:

In Async Code

await Future.delayed(Duration(seconds: 1));

In Sync Code

import 'dart:io';

sleep(Duration(seconds:1));

Note: This blocks the entire process (isolate), so other async functions will not be processed. It’s also not available on the web because Javascript is really async-only.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)