PostHog / PostHog/posthog-flutter
Sync API for feature flags
Nobody has claimed this yet.
- 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
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 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