delay function

Future<void> delay(
  1. bool addDelay, [
  2. int milliseconds = 2000
])

a small helper function to return a Future with a configurable delay

Implementation

Future<void> delay(bool addDelay, [int milliseconds = 2000]) {
  if (addDelay) {
    return Future<void>.delayed(Duration(milliseconds: milliseconds));
  } else {
    return Future<void>.value();
  }
}