Function expectAsyncUntil(Function callback, bool isDone(), { String id, String reason })

Indicate that callback is expected to be called until isDone returns true.

isDone is called after each time the function is run. Only when it returns true will the callback be considered complete. callback may take up to six optional or required positional arguments; named arguments are not supported.

Both id and reason are optional and provide extra information about the callback when debugging. id should be the name of the callback, while reason should be the reason the callback is expected to be called.

Source

Function expectAsyncUntil(Function callback, bool isDone(),
    {String id, String reason}) {
  if (Invoker.current == null) {
    throw new StateError(
        "expectAsyncUntil() may only be called within a test.");
  }

  return new _ExpectedFunction(callback, 0, -1,
      id: id, reason: reason, isDone: isDone).func;
}