replaceDerivationPathIndex function

String replaceDerivationPathIndex(
  1. String path,
  2. String suffix,
  3. int index
)

Implementation

String replaceDerivationPathIndex(String path, String suffix, int index) {
  final pathArr = path.split('/');
  pathArr.removeLast();
  pathArr.add('${pathArr.removeLast()}$suffix');
  pathArr.add(index.toString());
  return pathArr.join('/');
}