BoxAnswer.fromJson constructor
Implementation
factory BoxAnswer.fromJson(Map<String, Object?> json) {
final box = readObject(json, 'box');
try {
return BoxAnswer(
top: readDouble(box, 'top'),
bottom: readDouble(box, 'bottom'),
left: readDouble(box, 'left'),
right: readDouble(box, 'right'),
confidence: readDouble(json, 'confidence'),
);
} on ResponseValidationException catch (e) {
// Only the edges live under `box`; confidence sits beside it.
if (e.fieldPath == 'confidence') {
rethrow;
}
throw nestUnder(e, 'box');
}
}