PostHog / PostHog/posthog-flutter

Sync API for feature flags

Open
#241 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Feature flags
Dominant language
Dart
Stars
97
Forks
85
Avg merge
1d 8h
Merged PRs (30d)
31

Description

Problem Statement

Hi PostHog team,
I'm using the Flutter SDK and noticed that all feature flag functions (isFeatureEnabled(), getFeatureFlag(), getFeatureFlagPayload()) return Future — requiring async/await.
This is problematic in Flutter because widget build() methods are synchronous and cannot await async calls.
Looking at your other SDKs (Web, Node, ReactNative etc.), feature flag checks are synchronous. It would be great if the Flutter SDK could offer the same.

We are fetching and caching all the feature flags in the app launch as a workaround but its unsustainable and iOS SDK already caches it. We end up with double cache.

Thanks!

Solution Brainstorm

I believe this happens because the Flutter SDK wraps the native iOS/Android SDKs via platform channels, which are async by nature. A pure Flutter/Dart implementation would solve this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing isFeatureEnabled(), getFeatureFlag(), and getFeatureFlagPayload() through the Flutter SDK and its iOS/Android platform-channel wrappers. Review how feature flags are fetched and cached, then determine the scope needed for synchronous access in Flutter build() methods. Done means the requested synchronous API is defined and its behavior is covered consistently across the supported platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.