|
|
@ -48,6 +48,7 @@ Widget build(BuildContext context) { |
|
|
|
|
|
|
|
|
|
|
|
// Or use FlutterZxing |
|
|
|
// Or use FlutterZxing |
|
|
|
// To read barcode from camera image directly |
|
|
|
// To read barcode from camera image directly |
|
|
|
|
|
|
|
await FlutterZxing.startCameraProcessing(); // Call this in initState |
|
|
|
cameraController?.startImageStream((image) async { |
|
|
|
cameraController?.startImageStream((image) async { |
|
|
|
CodeResult result = await FlutterZxing.processCameraImage(image); |
|
|
|
CodeResult result = await FlutterZxing.processCameraImage(image); |
|
|
|
if (result.isValidBool) { |
|
|
|
if (result.isValidBool) { |
|
|
@ -55,6 +56,7 @@ cameraController?.startImageStream((image) async { |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
FlutterZxing.stopCameraProcessing(); // Call this in dispose |
|
|
|
|
|
|
|
|
|
|
|
// To read barcode from XFile, String or url |
|
|
|
// To read barcode from XFile, String or url |
|
|
|
XFile xFile = XFile('Your image path'); |
|
|
|
XFile xFile = XFile('Your image path'); |
|
|
|