optIn method

Future<void> optIn()

Opts the current user back in to data collection.

Reinstalls Flutter error autocapture. If optOut stopped session replay, this starts a new recording.

Returns a Future that completes when the opt-in request has been queued.

Implementation

Future<void> optIn() async {
  final config = _config;
  if (config != null) {
    _installFlutterIntegrations(config);
  }

  await _posthog.enable();
  final restartReplay = _restartSessionReplayOnEnable;
  _restartSessionReplayOnEnable = false;
  if (restartReplay) {
    PostHogInternalEvents.requestReplaySessionReset();
    PostHogInternalEvents.sessionRecordingActive.value = true;
  }
}