parseIndex function

int parseIndex(
  1. String jsonPath,
  2. int index
)

Parses an index from a JSON path expression.

Implementation

int parseIndex(String jsonPath, int index) {
  final buffer = StringBuffer();
  while (index < jsonPath.length && isDigit(jsonPath[index])) {
    buffer.write(jsonPath[index]);
    index++;
  }
  return int.parse(buffer.toString());
}