GuestWatch class
Tells the host when what it is looking at has moved, without being asked.
The problem this exists for. A tree is of one build. Entry switch,
reload, knob and axis change all notify; nothing notifies when the demo's
own state moves. That was invisible while a stale tree only showed slightly
wrong numbers — but once hovering a row draws a rectangle on screen, a stale
tree visibly lies: you hover Padding and a box appears over nothing.
Why not push the tree every frame. An animation almost never changes tree structure. It changes geometry. Re-sending fifty identical nodes with different rects sixty times a second, to move one rectangle, spends the most in exactly the case the feature was turned on for. So two things are watched separately, and only the one that changed is reported:
| tier | what moves | what is pushed |
|---|---|---|
| geometry | the watched node's box | the box |
| structure | the shape of the element tree | a flag — the host re-reads |
| resize | the demo's own box | a flag — every rect is stale at once |
| scroll | the offsets under a scrollable | a flag — the host waits, then re-reads |
The structure tier pushes a flag, not a tree. The host already knows how
to read ext.flutterware.tree; what it cannot do is know when to. Shipping
the tree inside the event would put the expensive walk on the frame that
detected the change, which is the frame that can least afford it.
Off unless something is watching, so an uninspected guest costs nothing — which is why this is a switch and not an install.
Constructors
- GuestWatch({required GuestInspector inspector, required Element? rootOf(), required String? entryIdOf(), void emit(WatchPush)?, int scrollsOf()?})
Properties
- entryIdOf → String? Function()
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- inspector → GuestInspector
-
final
- rootOf → Element? Function()
-
The demo's root element — the same subtree GuestInspector reports, so a
shape change here means a change to the tree the host is showing rather
than to the catalog chrome around it.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- watching → bool
-
no setter
Methods
-
describe(
) → WatchStats - What the watch has cost so far.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerExtensions(
) → void -
Registers the extension. Call once, before
runApp. -
toString(
) → String -
A string representation of this object.
inherited
-
unwatch(
) → void -
watch(
{String? nodeId, Duration minInterval = Duration.zero}) → void - Turns the watch on or off, and says what it is watching.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited