isElemValid method
Checks if the provided path element is valid according to Substrate path rules.
Implementation
bool isElemValid(String elem) {
return (elem.startsWith(SubstratePathConst.softPathPrefix) ||
elem.startsWith(SubstratePathConst.hardPathPrefix)) &&
elem.lastIndexOf("/") < 2 &&
elem.replaceAll("/", "").isNotEmpty;
}