PluginVersionCheckResult.fromJson constructor
PluginVersionCheckResult.fromJson(})
Implementation
factory PluginVersionCheckResult.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json,
{ClientUriConverter? clientUriConverter}) {
json ??= {};
if (json is Map) {
bool isCompatible;
if (json.containsKey('isCompatible')) {
isCompatible = jsonDecoder.decodeBool(
'$jsonPath.isCompatible', json['isCompatible']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'isCompatible');
}
String name;
if (json.containsKey('name')) {
name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'name');
}
String version;
if (json.containsKey('version')) {
version =
jsonDecoder.decodeString('$jsonPath.version', json['version']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'version');
}
String? contactInfo;
if (json.containsKey('contactInfo')) {
contactInfo = jsonDecoder.decodeString(
'$jsonPath.contactInfo', json['contactInfo']);
}
List<String> interestingFiles;
if (json.containsKey('interestingFiles')) {
interestingFiles = jsonDecoder.decodeList('$jsonPath.interestingFiles',
json['interestingFiles'], jsonDecoder.decodeString);
} else {
throw jsonDecoder.mismatch(jsonPath, 'interestingFiles');
}
return PluginVersionCheckResult(
isCompatible, name, version, interestingFiles,
contactInfo: contactInfo);
} else {
throw jsonDecoder.mismatch(jsonPath, 'plugin.versionCheck result', json);
}
}