Settle class sealed
How a scenario verb waits for the app to be done before it captures.
Every verb — pumpWidget, tap, enterText, screen — applies the same
policy, because which verb settles and which does not is exactly the
knowledge the high-level API exists to remove. Set it per scenario
(scenario('…', settle: …)) and override it per call
(s.tap(target, settle: Settle.none)).
The default is Settle.standard, and it is bounded on purpose:
pumpAndSettle never converges on a screen holding an indefinite animation
— a spinner, a shimmer, a looping Lottie — and throws
pumpAndSettle timed out when its ten fake minutes run out. A loading
spinner is the first thing most apps show, so the default must survive one:
it gives up quietly, captures the frame, and records settled: false on
the step. Use Settle.full where a screen that never settles should be an
error.
Frames are all a policy can follow, and a scenario needs one more thing.
Work that resolves on the real event loop — an asset read from the engine,
and the vector_graphics, Lottie or ImageProvider decode on the other end
of it — schedules no frame while it is in flight, so no policy here can wait
for it: upTo and frames see a quiet tree and elapse advances a clock
that real work does not read. Landing that work is a separate step a verb
takes after this one, deliberately not a policy: it is not a choice an
author makes, and a policy applied by hand through apply — as a plain
widget test does — should keep meaning exactly what it says. What a policy
does take is the apply hook that waits for such work between its own
frames, because a landing that only happens afterwards fills in the last
frame and leaves every earlier one with a hole in it.
This is also the one place a run records motion: a policy that owns its
pump loop hands every frame to the ScenarioFrameSink a run passes, and
pumps at that sink's finer interval while it does. One seam, and no verb
had to learn anything — a panel recording a transition and a film
recording a whole scenario arrive here as the same hook.
Under ScenarioTime.real every duration here is a real one:
tester.pump(interval) on the live binding waits the interval on the wall
clock and then a real frame, so upTo(5s) reads "until quiet, at most
five real seconds" and elapse(2s) costs two real seconds. Nothing in the
policies changes; only what a second is.
Constructors
- Settle.elapse(Duration budget)
-
Spend all of
budgeton the fake clock, whatever the frame loop is doing — the policy for work that waits on a timer rather than on frames.constfactory - Settle.frames(int count, {Duration interval})
-
countframes ofintervaleach, whatever is still scheduled at the end — how to capture a fixed way into an animation.constfactory - Settle.until(Object target, {Duration timeout})
-
Pump until
targetis on screen, then settle as standard does — for data that arrives without announcing itself.constfactory - Settle.upTo(Duration budget, {bool strict})
-
Pump while the app keeps asking for frames, stopping at the first frame
it does not — or when
budgetof the fake clock is spent, whichever comes first. Running out is not a failure — it is recorded on the step — unlessstrict, which makes it one after the step's real work has been landed. See Settle.strict.constfactory
Properties
- failsWhenUnsettled → bool
-
Whether a step this policy leaves unsettled is a failed step — true
for Settle.strict and any
upTo(…, strict: true).no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- waits → bool
-
Whether the app going quiet is what stops this policy.
no setter
Methods
-
apply(
WidgetTester tester, {ScenarioFrameSink? record, Future< void> land()?}) → Future<bool> - Applies the policy. False when the app was still scheduling frames when the policy gave up — the step is captured either way.
-
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
- full → const _Full
-
pumpAndSettle's own semantics, ten-minute timeout and throw included. - none → const _None
- One frame, no clock advance — for a capture that must show the app mid-transition, or after work the scenario already pumped itself.
- standard → const Settle
- The default: pump while the app keeps asking for frames, up to five seconds of the fake clock. Fifty frames at the ceiling, instant in wall time.
- strict → const Settle
-
standard, and red where it would have shrugged: the same five seconds
and the same landing of real work afterwards, but a screen still asking
for frames when both are done fails the step instead of recording
settled: falseand moving on.