*[<Null safety>](https://dart.dev/null-safety)*
int addNode (String name, Vnode node)
Adds a directory entry associating the given name
with node
.
It is ok to add the same Vnode multiple times with different names.
Returns ZX.OK
on success.
Returns ZX.ERR_INVALID_ARGS
if name is illegal object name.
Returns ZX.ERR_ALREADY_EXISTS
if there is already a node with the
given name.
Implementation
int addNode(String name, Vnode node) {
if (!_isLegalObjectName(name)) {
return ZX.ERR_INVALID_ARGS;
}
if (_entries.containsKey(name)) {
return ZX.ERR_ALREADY_EXISTS;
}
final id = _nextId++;
final e = _Entry(node, name, id);
_entries[name] = e;
_treeEntries.add(e);
return ZX.OK;
}