Flutter Feature Flags installation
Install with the wizard
Run this command in your project directory to add PostHog to your Flutter project. The wizard detects your framework, installs the SDK, and sets up your first events.
Or set it up manually by following the rest of this guide.
CocoaPods is becoming read-only. CocoaPods has announced the following schedule for its public specs repository:
- November 2–6, 2026: A read-only dry run will prevent us from publishing new PostHog iOS SDK versions to CocoaPods.
- December 2, 2026 onward: The repository will be permanently read-only. New PostHog iOS SDK versions will only be available through Swift Package Manager (SPM).
Existing native SDK versions will remain available through CocoaPods. To keep receiving native SDK updates on iOS and macOS, migrate your Flutter app to SPM. The
posthog_flutterpackage supports SPM, and Flutter 3.44 and later enable it by default. On earlier Flutter versions that support SPM, or if you disabled it, runflutter config --enable-swift-package-manager, then rebuild your app. Follow Flutter's SPM migration guide for project setup and troubleshooting.This change does not affect
posthog_flutterreleases on pub.dev, Android, or web.
- 1
Install the package
RequiredAdd the PostHog Flutter SDK to your
pubspec.yaml:pubspec.yaml - 2
Platform setup
RequiredAdd these values to your
AndroidManifest.xml:android/app/src/main/AndroidManifest.xmlUpdate the minimum Android SDK version to 21 in
android/app/build.gradle:android/app/build.gradleAdd these values to your
Info.plist:ios/Runner/Info.plistUpdate the minimum platform version to iOS 13.0 in your
Podfile:PodfileAdd these values in
index.html:web/index.html - 3
Send events
RecommendedOnce installed, PostHog will automatically start capturing events. You can also manually send events to test your integration:
Dart - 4
Evaluate boolean feature flags
RequiredCheck if a feature flag is enabled:
Dart - 5
Evaluate multivariate feature flags
OptionalFor multivariate flags, check which variant the user has been assigned:
Dart - 6
Running experiments
OptionalExperiments run on top of our feature flags. Once you've implemented the flag in your code, you run an experiment by creating a new experiment in the PostHog dashboard.
- 7
Next steps
RecommendedNow that you're evaluating flags, continue with the resources below to learn what else Feature Flags enables within the PostHog platform.
Resource Description Creating a feature flag How to create a feature flag in PostHog Adding feature flag code How to check flags in your code for all platforms Framework-specific guides Setup guides for React Native, Next.js, Flutter, and other frameworks How to do a phased rollout Gradually roll out features to minimize risk More tutorials Other real-world examples and use cases





