-
Notifications
You must be signed in to change notification settings - Fork 56
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.