threshold property

  1. @Deprecated('Use annotationsByThreshold instead. Will be removed in 9.0.')
double get threshold

The threshold (percentage of the barcode area vs screen area) that determines when to display close-up vs far-away annotations.

The value should be between 0.0 and 1.0, where 0.1 represents 10% of the screen area.

The default value is 0.05.

The threshold is a class-level property that applies to all instances of BarcodeArResponsiveAnnotation.

Added in version 8.2.0

Implementation

@Deprecated('Use annotationsByThreshold instead. Will be removed in 9.0.')
double get threshold => _legacyFarAwayEntry()?.key ?? BarcodeArDefaults.view.defaultResponsiveAnnotationThreshold;
  1. @Deprecated('Use annotationsByThreshold instead. Will be removed in 9.0.')
set threshold (double newValue)

The threshold (percentage of the barcode area vs screen area) that determines when to display close-up vs far-away annotations.

The value should be between 0.0 and 1.0, where 0.1 represents 10% of the screen area.

The default value is 0.05.

The threshold is a class-level property that applies to all instances of BarcodeArResponsiveAnnotation.

Added in version 8.2.0

Implementation

@Deprecated('Use annotationsByThreshold instead. Will be removed in 9.0.')
set threshold(double newValue) {
  if (!_usesLegacyTwoStateApi) {
    developer.log(
        'The deprecated threshold cannot be set on an annotation built with annotationsByThreshold. '
        'Rebuild the annotation with the desired thresholds instead.',
        name: 'BarcodeArResponsiveAnnotation.threshold');
    return;
  }
  var farAway = _legacyFarAwayEntry()?.value;
  var closeUp = _annotationsByThreshold[1.0];
  _annotationsByThreshold
    ..clear()
    ..addAll(_validate({newValue: farAway, 1.0: closeUp}));
  controller?.updateAnnotation(this);
}