PrioritizedSourceChange.fromJson constructor

PrioritizedSourceChange.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json, {
  4. ClientUriConverter? clientUriConverter,
})

Implementation

factory PrioritizedSourceChange.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is! Map) {
    throw jsonDecoder.mismatch(jsonPath, "'PrioritizedSourceChange'", json);
  }
  int priority;
  if (json case {'priority': var encodedPriority}) {
    priority = jsonDecoder.decodeInt('$jsonPath.priority', encodedPriority);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'priority'", json);
  }
  SourceChange change;
  if (json case {'change': var encodedChange}) {
    change = SourceChange.fromJson(
      jsonDecoder,
      '$jsonPath.change',
      encodedChange,
      clientUriConverter: clientUriConverter,
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'change'", json);
  }
  return PrioritizedSourceChange(priority, change);
}