EditBulkFixesResult.fromJson constructor
EditBulkFixesResult.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory EditBulkFixesResult.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
String message;
if (json.containsKey('message')) {
message =
jsonDecoder.decodeString('$jsonPath.message', json['message']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'message');
}
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');
}
List<BulkFix> details;
if (json.containsKey('details')) {
details = jsonDecoder.decodeList(
'$jsonPath.details',
json['details'],
(String jsonPath, Object? json) =>
BulkFix.fromJson(jsonDecoder, jsonPath, json));
} else {
throw jsonDecoder.mismatch(jsonPath, 'details');
}
return EditBulkFixesResult(message, edits, details);
} else {
throw jsonDecoder.mismatch(jsonPath, 'edit.bulkFixes result', json);
}
}