How can I “sleep” a Dart program

I like to simulate an asynchronous web service call in my Dart application for testing. To simulate the randomness of these mock calls responding (possibly out of order) I’d like to program my mocks to wait (sleep) for a certain period of time before returning the ‘Future’.

How can I do this?

8 Answers
8

Leave a Comment