startDocumentScanner method

  1. @override
Future<void> startDocumentScanner({
  1. required int maximumNumberOfPages,
  2. required bool galleryImportAllowed,
  3. required MlkitDocumentScannerMode scannerMode,
  4. required DocumentScannerResultMode resultMode,
})
override

This method starts the document scanner. It tries to mimic the official API as much as possible. Refer to this URL for more information: https://developers.google.com/ml-kit/vision/doc-scanner.

  • maximumNumberOfPages sets the limit to the number of pages scanned.
  • galleryImportAllowed enable or disable the capability to import from the photo gallery.
  • scannerMode customize the editing functionalities available to the user by choosing from 3 modes available in MlkitDocumentScannerMode.
  • resultMode sets the result format, this is, either JPEG pages or a single PDF document. This will determine which stream (jpegScanResults or pdfScanResults) will receive updates.

Implementation

@override
Future<void> startDocumentScanner({
  required int maximumNumberOfPages,
  required bool galleryImportAllowed,
  required MlkitDocumentScannerMode scannerMode,
  required DocumentScannerResultMode resultMode,
}) async {
  await _methodChannel.invokeMethod('startDocumentScanner', {
    'maximumNumberOfPages': maximumNumberOfPages,
    'galleryImportAllowed': galleryImportAllowed,
    'scannerMode': scannerMode.code,
    'resultMode': resultMode.code,
  });
}