setVibrateOnSuccessEnabled method

Future<void> setVibrateOnSuccessEnabled(
  1. bool enabled
)

Enables or disables the device vibration upon successfully decoding a barcode..

enabled: A boolean indicating whether to enable vibrate on success.

Example usage:

bool vibrateOnSuccessEnabled = true;
await _barkoder.setVibrateOnSuccessEnabled(vibrateOnSuccessEnabled);
print('Vibrate on success enabled: $vibrateOnSuccessEnabled');

Implementation

Future<void> setVibrateOnSuccessEnabled(bool enabled) {
  if (_isBarkoderViewNotMounted) {
    return Future.error(PlatformException(
        code: BarkoderErrors.barkoderViewNotMounted,
        message: BarkoderErrors.barkodeViewNotMountedDesc));
  }

  return _methodChannel.invokeMethod('setVibrateOnSuccessEnabled', enabled);
}