wait static method
Allows you to pause instructions for a set time.
await Future.delayed(Duration(milliseconds: milliseconds), () {});
EXAMPLE:
Once the state has changed, wait for the animation to finish, which will last 400 milliseconds and then close the context
setState(() => showWidget = false);
await Misc.wait(400);
Navigator.pop(context);
Implementation
static Future<void> wait(int milliseconds) async {
await Future.delayed(Duration(milliseconds: milliseconds), () {});
}