start method

Future<void> start()

Prepares the native scanner, subscribes to barcode events, and starts continuous scanning once the app has reached the resumed lifecycle state.

Implementation

Future<void> start() async {
  if (_active && !_userPaused) return;

  _starting = true;
  _notifyStateChanged();
  _userPaused = false;
  _lifecyclePaused = false;
  _pendingInitialStart = true;
  _ensureLifecycleListener();

  try {
    await _awaitAppResumed();
    _pendingInitialStart = false;
    _notifyStateChanged();

    if (_userPaused) return;

    await _startHardware();
  } finally {
    _pendingInitialStart = false;
    _starting = false;
    _notifyStateChanged();
  }
}