Skip to content

Surveys: Support linkedFlagVariant for targeting specific feature flag variants #259

@adboio

Description

@adboio

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:

  1. Get the actual flag value: flags[linkedFlagKey]
  2. Compare it to the variant: flagValue === linkedFlagVariant || linkedFlagVariant === "any"

Dependencies

This feature requires implementation in the native SDKs first:

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: PostHog/posthog#45658

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions