setBarcodeTypeEnabled method

Future<void> setBarcodeTypeEnabled(
  1. BarcodeType type,
  2. bool enabled
)

Sets whether a specific barcode type is enabled.

type: The BarcodeType to enable or disable. enabled: A boolean indicating whether to enable or disable the specified barcode type.

Example usage:

BarcodeType type = BarcodeType.code128;
bool isEnabled = true;
_barkoder.setBarcodeTypeEnabled(type, isEnabled);
print('Barcode type $type set to enabled: $isEnabled');

Implementation

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

  return _methodChannel.invokeMethod(
      'setBarcodeTypeEnabled', {'type': type.index, 'enabled': enabled});
}