OverlayMount class
Converges an OverlayEntry's mountedness onto a predicate: mounted while
mountWhen returns true, removed while it returns false.
This is the lazy-layer primitive for entries that exist up front (so their subtree state survives) but should only be MOUNTED while they have something to show — the runtime error banner, a toast layer. An entry that idles mounted-but-empty is not free: it keeps the host overlay multi-entry, which keeps the adaptive per-entry repaint boundaries engaged (see Overlay.addRepaintBoundaries) and taxes every app-dirty frame with a full-screen cache write + blit.
Actual mountedness is derived from the entry's overlay attachment each pass — never stored — so the helper cannot desync from the overlay's lifecycle: a pass that finds no overlay (teardown, not yet mounted) simply returns, and any later update retries with nothing to repair. The helper assumes it is the entry's only mount owner; don't also insert/remove the entry by hand.
The entry is always inserted ON TOP (no above/below anchor), on purpose: a lazily-mounted layer surfaces above whatever the app has stacked — an error banner must show over an opaque takeover entry, not under it.
Constructors
- OverlayMount({required OverlayEntry entry, required OverlayState? overlay(), required bool mountWhen()})
Properties
- entry → OverlayEntry
-
The entry whose mountedness this helper owns.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
attachTo(
Listenable listenable) → void -
Wires update to
listenable's notifications; undone by dispose. -
dispose(
) → void - Detaches listeners and removes entry if currently mounted. The entry itself is not disposed — it remains the caller's to reuse or dispose.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
) → void - Requests convergence a microtask from now.
-
updateNow(
) → void - Converges immediately instead of a microtask from now.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited