DetectedObject.from constructor

DetectedObject.from(
  1. Map json
)

Implementation

factory DetectedObject.from(Map json) {
  List<DetectedLabel> labels = [];

  if (json.containsKey('labels')) {
    List jsonLabels = json['labels'];

    for (Map label in jsonLabels) {
      labels.add(DetectedLabel.from(label));
    }
  }

  final trackingId = json['trackingId'];

  return DetectedObject(
    trackingId: trackingId != null ? trackingId as int : null,
    boundingBox: toRect(json['boundingBox']),
    labels: labels,
  );
}