JsonPath<T>.of constructor

JsonPath<T>.of(
  1. dynamic from, {
  2. JsonPath? relativeTo,
})

Implementation

factory JsonPath.of(dynamic from, {JsonPath? relativeTo}) {
  if (from is JsonPath && relativeTo != null) {
    return from.relativize(relativeTo).cast<T>();
  } else if (from is JsonPath<T> && relativeTo == null) {
    return from.cast<T>();
  } else if (from == null) {
    return JsonPath.root();
  } else {
    return JsonPath.parsed("$from", relativeTo: relativeTo);
  }
}