ServerLogEntry.fromJson constructor
ServerLogEntry.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory ServerLogEntry.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
int time;
if (json.containsKey('time')) {
time = jsonDecoder.decodeInt('$jsonPath.time', json['time']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'time');
}
ServerLogEntryKind kind;
if (json.containsKey('kind')) {
kind = ServerLogEntryKind.fromJson(
jsonDecoder, '$jsonPath.kind', json['kind']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'kind');
}
String data;
if (json.containsKey('data')) {
data = jsonDecoder.decodeString('$jsonPath.data', json['data']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'data');
}
return ServerLogEntry(time, kind, data);
} else {
throw jsonDecoder.mismatch(jsonPath, 'ServerLogEntry', json);
}
}