EditFormatIfEnabledResult.fromJson constructor

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

Implementation

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