ContextRoot.fromJson constructor
ContextRoot.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory ContextRoot.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
String root;
if (json.containsKey('root')) {
root = jsonDecoder.decodeString('$jsonPath.root', json['root']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'root');
}
List<String> exclude;
if (json.containsKey('exclude')) {
exclude = jsonDecoder.decodeList(
'$jsonPath.exclude', json['exclude'], jsonDecoder.decodeString);
} else {
throw jsonDecoder.mismatch(jsonPath, 'exclude');
}
String? optionsFile;
if (json.containsKey('optionsFile')) {
optionsFile = jsonDecoder.decodeString(
'$jsonPath.optionsFile', json['optionsFile']);
}
return ContextRoot(root, exclude, optionsFile: optionsFile);
} else {
throw jsonDecoder.mismatch(jsonPath, 'ContextRoot', json);
}
}