thenReturnInOrder method

void thenReturnInOrder(
  1. List<HttpResponse> responses
)

The stub returns each responses entry once, then sticks on the last.

Useful for retry tests: [serverError, serverError, success] exercises two retries before settling.

Implementation

void thenReturnInOrder(List<HttpResponse> responses) {
  assert(
    responses.isNotEmpty,
    'thenReturnInOrder requires at least one response',
  );
  _adapter._stubs.add(
    _build(
      responses.map(_Reply.success).toList(growable: false),
    ),
  );
}