fail method

void fail(
  1. Object error
)

Makes the request fail with error instead of answering, as a lost connection does; an HttpTransportException tests how the client retries or reports it.

Implementation

void fail(Object error) =>
    // Any object can be prepared as the failure, as the caller passes it.
    // ignore: only_throw_errors
    _expectation.answer = (request) async => throw error;