setCloseSessionOnResultEnabled method

Future<void> setCloseSessionOnResultEnabled(
  1. bool enabled
)

Enables or disables the automatic closing of the scanning session upon detecting a barcode result.

enabled: A boolean indicating whether to enable closing the session on result.

Example usage:

bool closeSessionEnabled = true;
_barkoder.setCloseSessionOnResultEnabled(closeSessionEnabled);
print('Close session on result enabled: $closeSessionEnabled');

Implementation

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

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