parse static method
Parses the input path and constructs a SubstratePath object.
The path should be a string representation of a Substrate path.
Throws a SubstratePathError if the path is invalid.
Implementation
static SubstratePath parse(String path) {
if (path.isNotEmpty && !path.startsWith('/')) {
throw ArgumentException.invalidOperationArguments(
"SubstratePath",
name: "path",
reason: "Invalid substrate path.",
);
}
/// Extract path elements using a regular expression and create a SubstratePath object.
final paths =
RegExp(
SubstratePathConst.rePath,
).allMatches(path).map((match) => match.group(0)!).toList();
return SubstratePath(paths.map((e) => SubstratePathElem(e)).toList());
}