PostHogConfig class

Configuration used to initialize the PostHog Flutter SDK.

Create an instance with your project token, customize any options, and pass it to Posthog().setup(config).

Constructors

PostHogConfig(String projectToken, {OnFeatureFlagsCallback? onFeatureFlags, List<BeforeSendCallback>? beforeSend})
Creates a configuration for projectToken.

Properties

apiKey → String
Deprecated alias for projectToken.
no setter
beforeSend ↔ List<BeforeSendCallback>
Callbacks to intercept and modify events before they are sent to PostHog.
getter/setter pair
bootstrap ↔ PostHogBootstrapConfig?
Pre-seeded identity and feature-flag state applied on the very first SDK launch, before any network request completes.
getter/setter pair
captureApplicationLifecycleEvents ↔ bool
Whether the SDK captures application lifecycle events automatically.
getter/setter pair
capturePushNotificationOpened ↔ bool
Whether to automatically capture $push_notification_opened when a user taps a PostHog-delivered notification.
getter/setter pair
capturePushNotificationSubscriptions ↔ bool
Whether to automatically register this device's push token with PostHog.
getter/setter pair
dataMode ↔ PostHogDataMode
Network connection types that can be used to send data on Apple platforms.
getter/setter pair
debug ↔ bool
Whether the SDK emits verbose debug logs.
getter/setter pair
errorTrackingConfig → PostHogErrorTrackingConfig
Configuration for error tracking and exception capture.
final
flushAt ↔ int
Number of queued events that triggers an automatic flush.
getter/setter pair
flushInterval ↔ Duration
Maximum time between automatic flush attempts.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
host ↔ String
The PostHog ingestion host.
getter/setter pair
logsConfig → PostHogLogsConfig
Configuration for the logs subsystem (Posthog().captureLog() and the Posthog().logger facade).
final
maxBatchSize ↔ int
Maximum number of events sent in a single batch.
getter/setter pair
maxQueueSize ↔ int
Maximum number of events stored in the local queue.
getter/setter pair
onFeatureFlags ↔ OnFeatureFlagsCallback?
Callback to be invoked when feature flags are loaded.
getter/setter pair
optOut ↔ bool
Whether the SDK starts with data collection disabled.
getter/setter pair
personProfiles ↔ PostHogPersonProfiles
Controls whether captured events create or update person profiles.
getter/setter pair
preloadFeatureFlags ↔ bool
Whether feature flags are loaded when the SDK starts.
getter/setter pair
projectToken → String
Your PostHog project token.
final
pushIdentityProvider ↔ PushIdentityProvider?
Mints a signed identity-verification token for push subscription requests.
getter/setter pair
rageClickConfig ↔ PostHogRageClickConfig
Configuration for rage-click autocapture on iOS and Mac Catalyst.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sendFeatureFlagEvents ↔ bool
Whether calls that evaluate feature flags capture $feature_flag_called.
getter/setter pair
sessionReplay ↔ bool
Whether mobile session replay is enabled for Android and iOS.
getter/setter pair
sessionReplayConfig ↔ PostHogSessionReplayConfig
Configuration for mobile session replay.
getter/setter pair
surveys ↔ bool
Enable Surveys
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() → Map<String, dynamic>
Converts this configuration to a platform-channel map.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited