fromPath method

Slip39Node fromPath(
  1. String path
)

Implementation

Slip39Node fromPath(String path) {
  _validatePath(path);

  Iterable<int> children = _parseChildren(path);

  if (children.isEmpty) {
    return _root!;
  }

  return children.fold(_root!, (Slip39Node prev, int childNumber) {
    if (childNumber >= prev._children.length) {
      throw ArgumentError(
          'The path index ($childNumber) exceeds the children index (${prev._children.length - 1}).');
    }

    return prev._children[childNumber];
  });
}