scanBarcode method
Implementation
Future<String?> scanBarcode([String? path]) async {
path ??= (await _controller!.takePicture()).path;
final inputImage = InputImage.fromFilePath(path);
final barcodes = await _scanner?.processImage(inputImage);
if (barcodes != null && barcodes.isNotEmpty) {
final result = barcodes.first.rawValue;
if (result != null && result.isNotEmpty) {
return result;
}
}
return null;
}