ScenarioNetworkPolicy class

The answers one scenario has stated, and the log of what it actually asked for.

Reached as s.network. A stub is a fact about this scenario — the empty inbox, the 503, the train — and no recording of a real server can be asked to produce one on demand, which is why stating them is a separate door from ScenarioNetwork.live rather than a mode of it.

scenario('the inbox is empty', (s) async {
  s.network.get('/api/messages', json: []);
  await s.pumpWidget(const App());
  await s.screen('the empty state');
});

Properties

hashCode → int
The hash code for this object.
no setterinherited
mode → ScenarioNetwork
What answers a request no stub claimed.
final
requests → List<ScenarioRequest>
Every exchange this scenario has made, in order — the same list the step's Events pane is built from, for a body that wants to assert on it.
final
requestsEver → int
How many exchanges this scenario has made across every branch of its splits.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
store → ScenarioNetworkStore
Where ScenarioNetwork.replay reads and ScenarioNetwork.record writes. Untouched by the other two modes.
final

Methods

any({Object? json, List<int>? body, String? contentType, int status = 200, Map<String, String> headers = const {}, Object? throws}) → void
Answers everything no other stub claimed, whatever the method.
delete(Pattern url, {Object? json, List<int>? body, String? contentType, int status = 200, Map<String, String> headers = const {}, Object? throws}) → void
Answers DELETE [url]. See stub.
dispose() → void
Closes the real client, if one was ever made. Called by the harness at the end of the body — see _real.
get(Pattern url, {Object? json, List<int>? body, String? contentType, int status = 200, Map<String, String> headers = const {}, Object? throws}) → void
Answers GET [url]. See stub for the parameters.
image(Pattern url, List<int> png) → void
Answers an image request with real bytes — a PNG a fixture already holds, or one scenarioPlaceholderPng made.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patch(Pattern url, {Object? json, List<int>? body, String? contentType, int status = 200, Map<String, String> headers = const {}, Object? throws}) → void
Answers PATCH [url]. See stub.
post(Pattern url, {Object? json, List<int>? body, String? contentType, int status = 200, Map<String, String> headers = const {}, Object? throws}) → void
Answers POST [url]. See stub.
put(Pattern url, {Object? json, List<int>? body, String? contentType, int status = 200, Map<String, String> headers = const {}, Object? throws}) → void
Answers PUT [url]. See stub.
resetForReplay() → void
Drops every stated answer, for the next replay of a split.
stub(String method, Pattern url, {Object? json, List<int>? body, String? contentType, int status = 200, Map<String, String> headers = const {}, Object? throws}) → void
States what method url answers.
toString() → String
A string representation of this object.
inherited

Operators

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