SiteState class

Manages the application's state for a collection of sites, represented as a tree structure.

This class is the central hub for all data related to the sites, including the tree data itself, the currently selected node, and the overall label for the site collection.

It implements the ObservableSubject interace, allowing other parts of the application to subscribe to state changes. When the state is modified (e.g., a node is selected, deleted, or a new site is added), it notifies all attached SiteStateObservers.

Implemented types

Constructors

SiteState()
Initializes the site state, loading the initial data from fakeSites.

Properties

hashCode int
The hash code for this object.
no setterinherited
label String
The top-level label for the site collection. Defaults to 'Sites'.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedNode LeafNode?
The currently selected node in the tree, or null if no node is selected.
getter/setter pair
treeData List<TreeNode>
The root-level nodes of the site hierarchy.
no setter

Methods

addNodes(List<LeafNode> nodes) → void
Adds a list of nodes to the tree.
addSite(String name) TreeNode
Adds a new top-level site to the collection and returns a reference to it.
attach(NodeObserver observer) → void
Attaches an observer to the subject.
override
deleteNode(LeafNode node) → void
Deletes a node from the tree.
detach(NodeObserver observer) → void
Detaches an observer from the subject.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify() → void
Notifies all attached observers of a change.
override
toString() String
A string representation of this object.
inherited

Operators

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