startDocumentScanner static method
- @Deprecated('Use ScanbotSdkUiV2.startDocumentScanner instead.')
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(
DocumentScannerScreenConfiguration 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 _channel.invokeMethod('startDocumentScanner', configuration);
if (SharedCalls.wasCanceled(result)) {
return DocumentScanningResult.canceled();
}
return DocumentScanningResult.fromJson(jsonDecode(result));
} on PlatformException catch (e) {
Logger.root.severe(e);
return DocumentScanningResult.error(
e.message ?? 'Unknown platform error');
} on Exception catch (e) {
return DocumentScanningResult.error(e.toString());
}
}