JsonPointer constructor

JsonPointer([
  1. String expression = ''
])

Creates a new JSON Pointer from a string expression. Throws a FormatException if the expression has invalid format. Example:

final pointer = JsonPointer('/foo/bar');

Implementation

factory JsonPointer([String expression = '']) {
  if (expression.isEmpty) return EmptyJsonPointer();
  _validate(expression);
  return build(expression.split('/').skip(1).map(Reference.unescape));
}