detectionStream property

Stream<CameraDetectionEvent> get detectionStream

Stream of detection results from native camera.

Implementation

Stream<CameraDetectionEvent> get detectionStream {
  return _eventChannel.receiveBroadcastStream().map((event) {
    final map = event as Map;
    final list = (map['detections'] as List?) ?? [];
    final dets = list.map((e) => DetectionResult.fromMap(e as Map)).toList();
    return CameraDetectionEvent(
      detections: dets,
      imageWidth: (map['imageWidth'] as int?) ?? 0,
      imageHeight: (map['imageHeight'] as int?) ?? 0,
      inferenceMs: (map['inferenceMs'] as int?) ?? 0,
      deviceRotation: (map['deviceRotation'] as int?) ?? 0,
    );
  });
}