By Alvin Alexander. Last updated: April 3, 2022
As a brief note, these are two different ways to do a “sleep” call in Flutter/Dart, depending on your needs:
// inside an async method await Future.delayed(const Duration(milliseconds: 250)); // not in an async method sleep(const Duration(milliseconds: 250));
As shown, the first approach is for when you want an async/await approach, and the second sleep method is for when you are doing things in serial order (as opposed to a parallel/concurrent approach).