SelectionContainerDelegate class

Coordinates a set of Selectable children behind one parent SelectionRegistrar.

Reading-order routing. When a SelectionEvent arrives, the delegate iterates its children sorted by Selectable.cellBounds (row, then column), dispatches the event, and inspects the returned SelectionResult to decide where the live edge wound up. Two-edge events (start/end) result in:

  • All children before the start edge: no selection.
  • The child holding the start edge: selection from the edge onward through its content (or up to the end edge if both fall here).
  • Children between the start and end edges: fully selected.
  • The child holding the end edge: selection from its first character up to the edge.
  • All children after the end edge: no selection.

Stale geometry. A Selectable that hasn't painted yet (or has been hidden) returns null cellBounds. Those are silently skipped — they don't appear in reading order until they next paint.

Inheritance
Implemented types

Properties

cursor → CellOffset?
The moving edge (cursor) in screen-space cell coordinates, or null when no selection is active. Equivalent to selection?.end — exposed so keyboard extenders (Shift+Arrow, Shift+Home, Shift+End) can compute the next edge position.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether at least one listener is registered.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectableCount → int
Number of registered Selectables. Exposed for diagnostics and tests.
no setter
selectables → Iterable<Selectable>
Read-only view of registered Selectables. Iteration order is registration order — NOT screen reading order. Use this when you need to visit every registered Selectable without caring about position (e.g. SelectionArea's auto-scroll computing the union of visible bounds). For reading-order traversal, the delegate handles it internally via getSelectedText and the like.
no setter
selection → Selection?
The live selection in screen-space cell coordinates, or null when nothing is selected.
no setter

Methods

add(Selectable selectable) → void
Registers a Selectable. Idempotent — re-adding the same Selectable is a no-op.
override
addListener(VoidCallback listener) → void
Registers listener to be called when this object changes.
inherited
clear() → void
Drops the selection state entirely. Equivalent to dispatching a SelectionClearEvent.
dispatchSelectionEvent(SelectionEvent event) → void
Pushes event to every Selectable in reading order. Used by the gesture machine in SelectionArea whenever a user action produces an event.
dispose() → void
Marks this notifier as disposed and drops its listeners. Nulls the slots in place (rather than replacing the backing list) so a dispose called from within a listener leaves any in-progress notify walk reading valid, now-empty slots. After disposal, addListener and notify throw; removeListener remains safe for cleanup.
override
findNextGraphemeBoundary(CellOffset from, int dCol, int dRow) → CellOffset?
Asks Selectables in reading order for the screen-space cell position one full grapheme away from from in (dCol, dRow). Returns null when no Selectable can step from there — the caller (typically Shift+Arrow) leaves the cursor in place.
getSelectedText() → String
Concatenates the selected portions of all Selectables (in reading order) into one user-facing string. Empty when no Selectable reports any selected content.
listen(VoidCallback listener) → VoidCallback
Registers listener and returns an idempotent cancellation function.
inherited
moveCursorTo(CellOffset position) → void
Moves the moving edge to position without altering the anchor. The caller is responsible for ensuring an anchor already exists; if no selection is in flight the cursor update is a no-op (Shift+Arrow with nothing selected does nothing).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify() → void
Publishes a change to every listener registered when the pass began.
inherited
remove(Selectable selectable) → void
Deregisters a Selectable. Safe to call on a Selectable that was never added.
override
removeListener(VoidCallback listener) → void
Removes a previously-registered listener.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

debugSelectedTextBuilds ↔ int
Test-only process-wide count of getSelectedText calls.
getter/setter pair