generateChildPath static method

String generateChildPath(
  1. String parentPath,
  2. int childPosition
)

Generates a child path hash based on parent's path and child position Examples:

  • First child of root "1" becomes "1.1"
  • Second child of root "1" becomes "1.2"
  • First child of "1.1" becomes "1.1.1"

Implementation

static String generateChildPath(String parentPath, int childPosition) {
  if (childPosition < 1) {
    throw ArgumentError('Child position must be 1 or greater');
  }
  return '$parentPath.$childPosition';
}