capturePhoto method

Future<CaptureResult> capturePhoto({
  1. required String folder,
  2. String prefix = 'capture',
})

Capture current frame. Saves clean + annotated images to folder. Returns paths and detections.

Implementation

Future<CaptureResult> capturePhoto({required String folder, String prefix = 'capture'}) async {
  final result = await _methodChannel.invokeMapMethod<String, dynamic>('capturePhoto', {
    'folder': folder,
    'prefix': prefix,
  });
  final dets = ((result?['detections'] as List?) ?? []).map((e) => DetectionResult.fromMap(e as Map)).toList();
  return CaptureResult(
    cleanPath: result?['cleanPath'] as String? ?? '',
    annotatedPath: result?['annotatedPath'] as String? ?? '',
    detections: dets,
  );
}