PostHog / PostHog/posthog-flutter
Surveys: Support linkedFlagVariant for targeting specific feature flag variants
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 97
- Forks
- 85
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 31
Description
Summary
The Flutter SDK does not support linkedFlagVariant for surveys. Since Flutter wraps the native iOS and Android SDKs, this depends on those SDKs implementing the feature first.
Current State
Flutter currently requires:
- iOS SDK: >= 3.38.0 (does not support linkedFlagVariant)
- Android SDK: >= 3.25.0 (does not support linkedFlagVariant)
The native SDKs only check if a linked feature flag is enabled (isFeatureEnabled), but do not support targeting users in a specific variant of that flag.
Expected Behavior
When a survey has conditions.linkedFlagVariant set (e.g., "variant-a"), the SDK should:
- Get the actual flag value:
flags[linkedFlagKey] - Compare it to the variant:
flagValue === linkedFlagVariant || linkedFlagVariant === "any"
Dependencies
This feature requires implementation in the native SDKs first:
- iOS: https://github.com/PostHog/posthog-ios/issues/445
- Android: https://github.com/PostHog/posthog-android/issues/388
Once implemented, Flutter will need to bump its minimum native SDK dependency versions.
Reference Implementation
See posthog-react-native: packages/react-native/src/surveys/getActiveMatchingSurveys.ts lines 77-83
Tracking
This is tracked in the survey SDK feature parity issue: https://github.com/PostHog/posthog/issues/45658
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reference implementation in packages/react-native/src/surveys/getActiveMatchingSurveys.ts, lines 77-83, then review the linked iOS and Android issues and the Flutter native SDK dependency versions. Done means the native SDKs support linkedFlagVariant and Flutter raises its minimum versions so surveys can target a specific variant or any variant.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- mobile-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100