RealWork class abstract final

Work that finishes on the real event loop, announced so a scenario's next verb waits for it instead of guessing.

A scenario runs under fake time, where a settle follows frames and nothing else. Work that resolves on the real event loop — a file read, a model import, a decode on an engine thread, an isolate — schedules no frame while it is in flight, so the tree looks finished and the step photographs a placeholder. The harness lands the two kinds of such work it can see for itself (a pending ImageProvider, an asset read through the scenario's bundle) and spends a dozen turns of the real loop guessing at the rest — enough for an SVG, nowhere near enough for a 6 MB import.

This is the third counter, and the only one the app fills in. Hand the future here and every verb that follows waits, in real milliseconds, until it has completed — then pumps, so whatever it set state on is drawn before the step is judged or photographed:

@override
void initState() {
  super.initState();
  _model = RealWork.track(_loadModel(), label: 'scene model');
}

Outside a scenario it is a set insert, a listener on the future and a set remove: no zone, no timer, no stack trace — that is captured only once a scenario has started in the process, because only a scenario's deadline ever reads it. A future tracked by one scenario is forgotten when the next begins, so a load that never finished cannot hold every later scenario hostage.

There is deliberately no counter-registration form. A process-wide counter cannot be reset between scenarios by anything but the app, and a count left non-zero by one scenario would be waited on by every scenario after it — the shape the image cache already bit with. A counter is easy to turn into a future: complete one when it reaches zero, and track that.

Properties

hashCode → int
The hash code for this object.
no setterinherited
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

Static Properties

pending → int
How many tracked futures have not completed.
no setter
pendingWork → List<TrackedRealWork>
The pending ones, oldest first, for whoever is about to say why a scenario is stuck.
no setter

Static Methods

run<T>(Future<T> work(), {String? label}) → Future<T>
Runs work in the root zone and announces it, the way track does.
track<T>(Future<T> work, {String? label}) → Future<T>
Announces work and hands it straight back.