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