scanBarcode static method
Scan with the camera until a barcode is identified, then return.
Shows a scan line with lineColor
over a scan window. A flash icon is
displayed if isShowFlashIcon
is true. The text of the cancel button can
be customized with the cancelButtonText
string.
Implementation
static Future<String> scanBarcode(String lineColor, String cancelButtonText, bool isShowFlashIcon, ScanMode scanMode) async {
if (cancelButtonText.isEmpty) {
cancelButtonText = 'Cancel';
}
// Pass params to the plugin
Map params = <String, dynamic>{'lineColor': lineColor, 'cancelButtonText': cancelButtonText, 'isShowFlashIcon': isShowFlashIcon, 'isContinuousScan': false, 'scanMode': scanMode.index};
/// Get barcode scan result
final barcodeResult = await _channel.invokeMethod('scanBarcode', params) ?? '';
return barcodeResult;
}