processImage method
Future<void>
processImage(
- InputImage inputImage
)
Implementation
Future<void> processImage(InputImage inputImage) async {
if (_isBusy) return;
_isBusy = true;
final recognizedText = await _textRecognizer.processImage(inputImage);
if (inputImage.metadata?.size != null &&
inputImage.metadata?.rotation != null &&
cameraPrev.currentContext != null) {
final renderBox = cameraPrev.currentContext?.findRenderObject();
if (renderBox == null) {
return;
}
var painter = TextRecognizerPainter(
recognizedText,
inputImage.metadata!.size,
inputImage.metadata!.rotation,
renderBox as RenderBox,
(value) {
widget.getScannedText(value);
},
boxLeftOff: widget.painBoxLeftOff,
boxBottomOff: widget.painBoxBottomOff,
boxRightOff: widget.painBoxRightOff,
boxTopOff: widget.painBoxTopOff,
paintboxCustom: widget.paintboxCustom,
);
customPaint = CustomPaint(painter: painter);
} else {
customPaint = null;
}
Future.delayed(widget.throttlingInterval).then(
(value) {
_isBusy = false;
if (mounted) {
setState(() {});
}
},
);
}