TomlExpandController class

Centralized controller for expand/collapse state across the tree.

Uses path-based keys (e.g. server.database.port) to avoid collisions between nodes at different nesting levels.

State is stored sparsely: only paths the user (or your code) has explicitly toggled are tracked. Everything else falls back to defaultExpanded, which expandAll and collapseAll flip wholesale — that is what makes them work on nodes that have never been touched.

final controller = TomlExpandController(defaultExpanded: false);
TomlView(content: toml, expandController: controller);
controller.expand('server.tls'); // reveals the node and its ancestors
Inheritance

Constructors

TomlExpandController({bool defaultExpanded = true})
Creates a controller whose untouched nodes start defaultExpanded.

Properties

defaultExpanded → bool
Whether nodes start expanded by default.
final
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
overrides → Map<String, bool>
The paths with an explicitly recorded state, for persistence.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
collapse(String path) → void
Collapse the node at path.
collapseAll() → void
Collapse every node, including ones never toggled.
dispose() → void
Discards any resources used by the object.
inherited
expand(String path) → void
Expand the node at path.
expandAll() → void
Expand every node, including ones never toggled.
expandToPath(String path) → void
Expands path and every ancestor along it, so the node is reachable.
isExpanded(String path) → bool
Whether the node at path is currently expanded.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reset() → void
Reset all state back to defaultExpanded.
restore(Map<String, bool> overrides) → void
Restore a previously captured set of overrides.
setExpanded(String path, bool expanded) → void
Sets the node at path to expanded, notifying only if it changed.
toggle(String path) → void
Toggle the node at path.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

ancestorsOf(String path) → List<String>
Returns every ancestor path of path, outermost first.