Answers for "how to wait until result of async is returned dart"

0

how to wait until result of async is returned dart

void waitForIt async {
  print('START');
  if (await (fetchResults())) {
    print('COMPLETE');
  }
}

Future<bool> fetchResults() async {
  return Future.delayed(const Duration(milliseconds: 3000), () {
    return true;
  });
}
Posted by: Guest on February-01-2022

Code answers related to "Dart"

Browse Popular Code Answers by Language