scan static method
Scans a document and returns the file path(s) of the scanned document(s).
Throws a DocScanException if the scan fails.
Implementation
static Future<List<String>?> scan({
DocScanFormat format = DocScanFormat.jpeg,
}) async {
try {
final result = await _channel.invokeMethod('scanDocument', {
'format': format == DocScanFormat.pdf ? 'pdf' : 'jpeg',
});
if (result == null || result is! List) {
throw DocScanException(
'Invalid response from native code, expected a List, got $result',
);
}
return result.cast<String>();
} on PlatformException catch (e) {
throw DocScanException(e.message ?? 'Unknown error');
}
}