EditGetAssistsResult.fromJson constructor

EditGetAssistsResult.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json
)

Implementation

factory EditGetAssistsResult.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    List<SourceChange> assists;
    if (json.containsKey('assists')) {
      assists = jsonDecoder.decodeList(
          '$jsonPath.assists',
          json['assists'],
          (String jsonPath, Object? json) =>
              SourceChange.fromJson(jsonDecoder, jsonPath, json));
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'assists');
    }
    return EditGetAssistsResult(assists);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'edit.getAssists result', json);
  }
}