startDocumentScanner static method
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 ScanbotSdk.channel
.invokeMethod('startDocumentScannerV2', config.toJson());
return ResultWrapper.fromJson(jsonDecode(result),
fromJsonT: (data) =>
DocumentData.fromJson(data as Map<String, dynamic>));
} on PlatformException catch (e) {
Logger.root.severe(e);
return ResultWrapper.error(e.message ?? 'Unknown platform error');
} on Exception catch (e) {
return ResultWrapper.error(e.toString());
}
}