scanFile static method
If formats
parameter is an empty list
it will scan for all possible formats
Implementation
static Future<String?> scanFile({
required String path,
List<BarcodeFormat> formats = const [],
}) async {
try {
final listFormats = _conventFormatsToList(formats);
Map<String, dynamic> arguments = {
'filePath': path,
'barcodeFormats': listFormats,
};
if (path.endsWith('.pdf')) {
return _channel.invokeMethod('scan_pdf', arguments);
}
return _channel.invokeMethod('scan_image', arguments);
} catch (e) {
throw Exception();
}
}