startDocumentScanner static method

  1. @Deprecated('Use ScanbotSdkUiV2.startDocumentScanner instead.')
Future<DocumentScanningResult> startDocumentScanner(
  1. DocumentScannerConfiguration config
)

Starts the Ready-to-Use Document Scanner UI as full-screen modal UI dialog. The Document Scanner provides guided, automatic document scanning.

Implementation

@Deprecated('Use ScanbotSdkUiV2.startDocumentScanner instead.')
static Future<DocumentScanningResult> startDocumentScanner(
    DocumentScannerConfiguration config) async {
  try {
    var updatedParameters = config.toJson();
    const defaultJsonName = "DocumentScreen";
    var configuration = await SharedCalls.applyParametersOnDefaultJson(
        defaultJsonName, updatedParameters);
    var docSize = configuration['documentImageSizeLimit'];
    if (docSize['width'] == 0 || docSize['height'] == 0) {
      configuration.remove('documentImageSizeLimit');
    }

    var result = await SharedCalls.invoke(
        _channel, 'startDocumentScanner', configuration);
    if (SharedCalls.wasCanceled(result)) {
      return DocumentScanningResult.canceled();
    }
    return DocumentScanningResult.fromJson(jsonDecode(result));
  } catch (e) {
    Logger.root.severe(e);
    return DocumentScanningResult.error(e.toString());
  }
}