scanBarcode static method

Future<String> scanBarcode(
  1. String lineColor,
  2. String cancelButtonText,
  3. bool isShowFlashIcon,
  4. ScanMode scanMode, {
  5. String? validationPattern,
})

Implementation

static Future<String> scanBarcode(
  String lineColor,
  String cancelButtonText,
  bool isShowFlashIcon,
  ScanMode scanMode, {
  String? validationPattern,
}) async {
  if (lineColor.length != 7 || !lineColor.startsWith("#")) {
    throw new FormatException(
        "Invalid lineColor format. It should be a valid hex color of the form #RRGGBB.");
  }

  final String barcodeScanRes = await _channel.invokeMethod('scanBarcode', {
    "lineColor": lineColor,
    "cancelButtonText": cancelButtonText,
    "isShowFlashIcon": isShowFlashIcon,
    "scanMode": scanMode.index,
    "validationPattern": validationPattern,
  });

  return barcodeScanRes;
}