setRegionOfInterest method

Future<void> setRegionOfInterest(
  1. double left,
  2. double top,
  3. double width,
  4. double height
)

Defines the Region of Interest (ROI) on the camera preview for barcode scanning, specifying an area where the application focuses on detecting barcodes.

left: The left coordinate of the ROI. top: The top coordinate of the ROI. width: The width of the ROI in percentage. height: The height of the ROI in percentage.

Example usage:

double left = 10.0;
double top = 10.0;
double width = 80.0;
double height = 8.0;
_barkoder.setRegionOfInterest(left, top, width, height);
print('Region of interest set');

Implementation

Future<void> setRegionOfInterest(
    double left, double top, double width, double height) {
  if (_isBarkoderViewNotMounted) {
    return Future.error(PlatformException(
        code: BarkoderErrors.barkoderViewNotMounted,
        message: BarkoderErrors.barkodeViewNotMountedDesc));
  }

  return _methodChannel.invokeMethod('setRegionOfInterest',
      {'left': left, 'top': top, 'width': width, 'height': height});
}