Node constructor

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

The simple Node that use a Map 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

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