PostHog / posthog-flutter

PostHog Flutter SDK
https://posthog.com/docs/libraries/flutter
MIT License
55 stars 37 forks source link

Feature-Flag not loaded #109

Closed nrobi144 closed 5 months ago

nrobi144 commented 5 months ago

Version

4.4.1

Steps to Reproduce

  1. Call await getFeatureFlagPayload(key) right after Posthog() initialization/creation

Similar issue to https://posthog.com/questions/feature-flag-not-working

Expected Result

Actual Result

Sometimes getFeatureFlagPayload() returns the payload, sometimes it returns null. Also there's no way to ensure Feature Flags are loaded, other than adding an artificial delay?

marandaneto commented 5 months ago

Hi @nrobi144

That is a dupe of https://github.com/PostHog/posthog-flutter/issues/81

The await is only about the bridge call but not the whole flags to be loaded, this still has to be implemented.

The flags are cached in the disk, so technically if you want to use flags right after init, you just need the artificial delay once, the very first time the app opens and has internet, all the following times will be read from the disk if the flags request isn't finished in time.