GgRouteTreeNode class

GgRouteTreeNode represents a node in a route tree.


GgRouteTreeNode({required String name, GgRouteTreeNode? parent})
The node's constructor.
Create a root node


ancestors List<GgRouteTreeNode>
no setter
children Iterable<GgRouteTreeNode>
Returns the node's children.
no setter
childToBeFadedIn GgRouteTreeNode?
Returns the child that needs to be faded in
no setter
childToBeFadedOut GgRouteTreeNode?
Returns the child that needs to be faded out
no setter
defaultChild GgRouteTreeNode?
Returns the default child if some exists
no setter
defaultChildName String?
The default child is chosen, when you want to navigate to LAST and no child is already staged.
getter/setter pair
errorHandler ↔ (void Function(GgRouteTreeNodeError)?)
Returns the error handler.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Returns true, once dispose was called
no setter
isIndexChild bool
no setter
isRoot bool
Returns true, if this node is root.
no setter
isStaged bool
Returns true if this node is staged.
no setter
json String
Converts the route tree into a JSON string
getter/setter pair
name String
The name of the node. The name will appear as path segment in the URI.
needsFade bool
Returns true if this node needs to be faded in when staged or faded out when not staged. The value is reset by GgRouterWidget after the node has been faded in or out.
getter/setter pair
onChange Stream<void>
Informs about any changes of the node itself as well as its children.
no setter
onIsStaged Stream<bool>
Returns a stream informing when isStaged changes.
no setter
onOwnOrChildParamChange Stream<void>
A stream that informs when the node's own or its child parameters change.
no setter
onOwnParamChange Stream<void>
A stream that informs when the node's parameters change.
no setter
parent GgRouteTreeNode?
The parent node.
path String
Returns the path of this node as a string.
getter/setter pair
pathHashCode int
Returns the hash of the own path.
getter/setter pair
pathSegments List<String>
Returns the path of this node as a list of segments.
getter/setter pair
root GgRouteTreeNode
The root parent of this node or the node itself, when it is a node.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel String
Returns the semantic label of the node or the node when none has been set.
getter/setter pair
stagedChild GgRouteTreeNode?
Returns the staged child or null if no child is staged.
no setter
stagedChildDidChange Stream<GgRouteTreeNode?>
Informs if the staged child did change.
no setter
stagedChildPath String
no setter
stagedChildPathSegments List<String>
Returns the path of staged children as a list of path segments.
getter/setter pair
stagedDescendants List<GgRouteTreeNode>
Returns a list containing all staged descendants.
no setter
stagedDescendantsInklSelf List<GgRouteTreeNode>
Returns a list containing all staged descendants inkl. the node itself.
no setter
stagedParams Map<String, GgValue>
Returns all parameters of the staged path.
no setter
uriParams Map<String, dynamic>
Use uriParams to apply parameters taken from a URI to the staged tree. These parameters are used to initialize node parameters.
getter/setter pair
widgetIndex int?
Returns the index in the parent's children array.
getter/setter pair


child(String name) GgRouteTreeNode?
Returns a child node with name. If none exists, null is returned
descendants({required List<String> path}) GgRouteTreeNode
Returns descendant that matches the path. Creates the node when needed.
dispose() → dynamic
Call this function when the node is about to be disposed.
findOrCreateChild(String name) GgRouteTreeNode
Returns a child node with name. If none exists, one is created.
findOrCreateParam<T>({required String name, required T seed, T parse(String)?, String stringify(T)?}) → GgValue<T>
Finds or route param with name. If no param exists, one is created and initialized with seed.
hasChild({required String name}) bool
Returns true if the node has a child with name.
hasParam(String name) bool
Returns true if param with name exists, otherwise false is returned.
Activates the path in the node hierarchy.
nodeForPath(String path) GgRouteTreeNode
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
ownOrParentParam<T>(String name) → GgValue<T>?
Returns the param from this node or its parents.
param<T>(String name) → GgValue<T>?
Returns the parameter with name or null if no parameter with name exists.
parseJson({required String json, dynamic parseAllParamsDirectly = false}) → dynamic
Reads the JSON string and creates routes and parameters. Parameters that are not still existing in the route tree are safed in the right nodes for later use, but only if parseAllParamsDirectly is false.
removeChild(GgRouteTreeNode child) → void
Removes the child.
resetStaging({bool recursive = false}) → void
........................................................................... Sets back staging for the node and it's children
semanticLabelForPath(String path) String
setError(GgRouteTreeNodeError error) → void
Handle error or propagate it up the tree.
setSemanticLabelForPath({required String path, required String label}) → void
toString() String
A string representation of the node outputting the path of the node.
uriParamForName(String name) → dynamic
Returns the URI parameter for a given parameter name. Returns null, if no URI parameter exists for that name.


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

Static Methods

isValidName(String name) bool
.......................................................................... Returns true if name only contains letters, numbers, minus and underscore


semanticLabelJsonKey → const String
stagedChildJsonKey → const String
This key is used to store the staged child name to JSON