ScenarioNetwork enum

Inheritance
Available extensions

Values

off → const ScenarioNetwork

Nothing leaves the process.

A request nothing stubbed fails immediately, with a message naming the url and how to answer it, and lands on the step as a network event.

It does not fail the scenario. A decorative avatar is not a reason to throw away a flow's other twelve assertions, and a scenario that wants the picture says so with a stub, with replay or with live. That takes a filter to hold: an Image.network with no errorBuilder has no error listener of its own, so the throw reaches FlutterError.reportError, which in a test binding is what turns a test red — see the ScenarioNetworkRefusal clause in _runScenario. Without it, adopting this version would turn red every suite with an unguarded network image on screen, including the https ones that drew a blank frame and passed before any of this existed.

The default, and an improvement on what it replaces even for a suite that never configures anything: flutter_test's own answer hangs rather than fails when the url is https.

live → const ScenarioNetwork

Requests go out, and what comes back is whatever the network says today.

The easy mode and the honest one — the app talks to the thing it talks to. It costs the property every other default here exists to protect: two runs of the same suite are no longer the same run, an aeroplane or a rate limit turns a green suite red, and the image cache is emptied per scenario by design, so a suite pays its round trips once per scenario rather than once.

replay → const ScenarioNetwork

Requests are answered from the recording committed beside the scenarios, and nothing leaves the process.

What record wrote, played back — offline, in microseconds, and byte-identically. This is the mode a suite lives in: the author writes the scenario as though the network were simply there, records once, and commits what came back, and every run after that reproduces it with no connection at all.

A request the recording does not hold is refused, naming the url and the command that would record it. Answering it with a 404, or with silence, would put the store's gaps into the pictures instead of into the output.

record → const ScenarioNetwork

Requests go out, and what comes back is written to the recording.

Always out, never partly from the store: "refresh what I have" and "fill in what I am missing" are the same command otherwise, and the one you wanted is whichever you did not get. What it fetches it overwrites; what it does not ask for it leaves, so one endpoint can be refreshed by running one scenario.

The caller is handed the bytes that were written, not the bytes off the wire, so a record run and the replay runs after it draw the same pictures.

Properties

hashCode → int
The hash code for this object.
no setterinherited
index → int
A numeric identifier for the enumerated value.
no setterinherited
name → String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Constants

values → const List<ScenarioNetwork>
A constant List of the values in this enum, in order of their declaration.