startDocumentScanner static method

Future<ResultWrapper<DocumentData>> startDocumentScanner(
  1. DocumentScanningFlow config
)

Launches the Ready-to-Use V2 Document Scanner UI as a full-screen modal dialog.

This method manages the complete document scanning workflow, including image capture, document detection, and quality validation.

config: A DocumentScanningFlow object defining the scanning workflow configuration.

Returns: A Future that resolves to a ResultWrapper<DocumentData> containing the scanned document data or an error if the operation fails.

Implementation

static Future<ResultWrapper<DocumentData>> startDocumentScanner(
    DocumentScanningFlow config) async {
  try {
    var result = await SharedCalls.invoke(
        ScanbotSdk.channel, 'startDocumentScannerV2', config.toJson());

    return ResultWrapper.fromJson(jsonDecode(result),
        fromJsonT: DocumentData.fromJson);
  } catch (e) {
    Logger.root.severe(e);
    return ResultWrapper.error(e.toString());
  }
}