derivePath method

Substrate derivePath(
  1. String path
)

Derive a new Substrate context from the current context using the provided path.

This method creates a child context by applying the path to the current context. Returns the new Substrate context after applying the path.

Implementation

Substrate derivePath(String path) {
  final pathInstance = SubstratePathParser.parse(path);
  Substrate substrateObj = this;
  for (final pathElement in pathInstance.elems) {
    final parent = substrateObj;
    substrateObj = parent.childKey(pathElement);

    if (!identical(parent, this)) {
      parent.dispose();
    }
  }
  return substrateObj;
}