enable method

Future<void> enable()

Enables native packet capture on iOS and Android. Idempotent — safe to call multiple times.

Implementation

Future<void> enable() async {
  if (_enabled) return;
  _enabled = true;

  _subscription = _eventChannel.receiveBroadcastStream().listen(
        _onNativeEvent,
        onError: (_) {},
        cancelOnError: false,
      );

  try {
    await _methodChannel.invokeMethod<void>('enable');
  } catch (_) {}
}