Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

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;
  });
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #wait #result #async #returned #dart
ADD COMMENT
Topic
Name
9+6 =