IndexedNode constructor

IndexedNode({
  1. String? key,
  2. IndexedNode? parent,
})

The more comprehensive variant of Node that uses List to store the children.

Default constructor that takes an optional key and a parent. Make sure that the provided key is unique to among the siblings of the node. If a key is not provided, then a UniqueKey will automatically be assigned to the Node.

Implementation

IndexedNode({String? key, this.parent})
    : assert(key == null || !key.contains(INode.PATH_SEPARATOR),
          "Key should not contain the PATH_SEPARATOR '${INode.PATH_SEPARATOR}'"),
      this.children = <IndexedNode>[],
      this.key = key ?? UuidV4().generate();