RuntimeCompletionExpression.fromJson constructor
RuntimeCompletionExpression.fromJson(
- JsonDecoder jsonDecoder,
- String jsonPath,
- Object? json
)
Implementation
factory RuntimeCompletionExpression.fromJson(
JsonDecoder jsonDecoder, String jsonPath, Object? json) {
json ??= {};
if (json is Map) {
int offset;
if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'offset');
}
int length;
if (json.containsKey('length')) {
length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else {
throw jsonDecoder.mismatch(jsonPath, 'length');
}
RuntimeCompletionExpressionType? type;
if (json.containsKey('type')) {
type = RuntimeCompletionExpressionType.fromJson(
jsonDecoder, '$jsonPath.type', json['type']);
}
return RuntimeCompletionExpression(offset, length, type: type);
} else {
throw jsonDecoder.mismatch(jsonPath, 'RuntimeCompletionExpression', json);
}
}