fromPath static method
Create a empty node for the given path.
@param path the node path @param isTombstone true if the node is a tombstone node @param visibility the visibility of the node or null if default @param nodeValues the node values to be stored or null if none @param childNodes the child nodes to be included or null if none
Implementation
static Future<Node> fromPath(String path, String owner,
{bool? isTombstone,
Visibility? visibility,
List<NodeValue>? nodeValues,
List<Node>? childNodes}) async {
var node = NodeImpl(path, owner);
try {
if (isTombstone != null) {
await node.set(Field.tombstone, isTombstone ? 'true' : 'false');
}
if (visibility != null) {
await node.set(Field.visibility, visibility.toValueString());
}
if (nodeValues != null) {
for (var nv in nodeValues) {
await node.addValue(nv);
}
}
if (childNodes != null) {
for (var n in childNodes) {
await node.addChild(n);
}
}
} on StorageException {
throw Exception('Oops.... this should not happen... contact developer');
}
return node;
}