StubHttpAdapter class

Подменённая сеть с записью запросов и счётчиком вызовов по путям.

Constructors

StubHttpAdapter(FutureOr<StubResponse> _handler(RecordedRequest request))
StubHttpAdapter.always(StubResponse response)
Отдаёт один и тот же ответ на всё.
factory
StubHttpAdapter.byPath(Map<String, StubResponse> routes, {StubResponse fallback = const StubResponse(statusCode: 404)})
Ответы по пути запроса.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
requests → List<RecordedRequest>
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

close({bool force = false}) → void
Close the current adapter and its inner clients or requests.
countOf(String path) → int
Сколько раз дёрнули конкретный путь.
fetch(RequestOptions options, Stream<Uint8List>? requestStream, Future<void>? cancelFuture) → Future<ResponseBody>
Implement this method to make real HTTP requests.
headersOf(String path, String header) → List<String?>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
requestTo(String path) → RecordedRequest
Единственный запрос по пути. Падает, если их не один.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited