-
Notifications
You must be signed in to change notification settings - Fork 61
feat: Add getFeatureFlagResult API
#279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6458f44 to
7bf8fa6
Compare
|
CI will fail until PostHog/posthog-ios#459 is released |
getFeatureFlagPayload APIgetFeatureFlagResult API
7bf8fa6 to
483265d
Compare
android/src/main/kotlin/com/posthog/flutter/PosthogFlutterPlugin.kt
Outdated
Show resolved
Hide resolved
lib/src/feature_flag_result.dart
Outdated
| other.key == key && | ||
| other.enabled == enabled && | ||
| other.variant == variant && | ||
| other.payload == payload; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not doing deep equality, should we?
you can check PHListEquality().equals(...) if payload is a collection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opted to pull the payload out of the equals and hashCode implementations. I'm not sure there's a real use case for comparing these, but key / enabled / variant would likely be enough.
marandaneto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a few comments otherwise LGTM
It was replaced by `fromMap`
I'm not certain what the use case is to compare feature flag results, so I don't think it's worth deep comparing the result. Maybe we'll get feedback on this in the future and reconsider.
💡 Motivation and Context
Add a
getFeatureFlagResultAPI that returns a unifiedPostHogFeatureFlagResultobject containing the flag key, enabled state, variant (for multivariate flags), and payload in a single call. Previously, getting full flag information required separate calls togetFeatureFlagandgetFeatureFlagPayload. This also supports asendEventparameter to suppress the$feature_flag_calledevent when only the payload is needed.getFeatureFlagPayloadis now deprecated in favor of this new method.💚 How did you test it?
PostHogFeatureFlagResult(fromValueAndPayload,fromMap,equality,toString, null/edge cases)sendEventparameter forwardinggetFeatureFlagResult📝 Checklist