Evaluate feature flags
Gate features with remotely evaluated flags and variants.
Feature flags let you turn features on or off, and pick variants, without shipping a new build. Voidhash evaluates every flag for the current person, so the same flag can resolve differently for different customers. Use flags for staged rollouts, experiments, and remote configuration.
Evaluate flags
Pass the keys you need. Pass an empty list instead to evaluate every flag in the project:
val flags = voidhash.getFeatureFlags(listOf("new_onboarding", "pricing_test"))
val newOnboarding = flags.firstOrNull { it.key == "new_onboarding" }?.enabled == true
val pricing = flags.firstOrNull { it.key == "pricing_test" }Each result carries the flag's key, its enabled state, and the key of the selected variant. A
variant may also carry a payload, which you read from payload. Payloads are untyped JSON: the
value is a JSONObject, a JSONArray, a String, a Number, a Boolean, or null when the
variant has none. Validate a payload before you use it:
val copy = flags.firstOrNull { it.key == "onboarding_copy" }?.payload as? JSONObject
val headline = copy?.optString("headline")?.takeIf { it.isNotEmpty() } ?: "Welcome"Payloads are cached with the rest of the evaluation, so they are available offline too.
Identity behavior
Flag results are scoped to the current person. The SDK clears them after identify() or a reset,
so one customer never sees another customer's assignment.
Choose a safe default to use while flags are loading or unavailable. Do not use a feature flag to gate paid access. Use entitlement grants for that instead.