takeAndProcess method

Future<MemoryImage> takeAndProcess()

Takes shot and returns processed image of recognized document.

Implementation

Future<MemoryImage> takeAndProcess() async {
  _cameraController.pausePreview();
  assert(isAttached, 'ScannerController not attached to any preview views.');
  final image = await _cameraController.takePicture();
  final processedImage = await _scanner.processImage(image);
  final flutterImage = MemoryImage(
    processedImage.bytes.asTypedList(processedImage.length),
  );
  _cameraController.resumePreview();

  return flutterImage;
}