Shipeasy
ReferenceKotlin

Flags (feature gates)

getFlag(name) returns a Boolean — whether the gate is on for the evaluated user.

Generated from the SDK's own /docs/ — also served raw at https://shipeasy-ai.github.io/sdk-kotlin/pages/flags.md.

getFlag(name) returns a Boolean — whether the gate is on for the evaluated user.

Bound Client form

val flags = Client(currentUser)

if (flags.getFlag("new_checkout")) {
    // gate is on for this user
}

Default / fallback

getFlag accepts an optional default (defaults to false). The default is returned only when the gate cannot be evaluated — the SDK isn't initialized yet, or the flag isn't present in the loaded blob. It is never returned for a flag that legitimately evaluates to false.

// returns `true` only if the SDK isn't ready / the flag is unknown;
// a known flag that evaluates false still returns false
flags.getFlag("new_checkout", default = true)

getFlagDetail — value + reason

getFlagDetail returns the value plus a reason explaining it (LaunchDarkly variationDetail parity). The reason is computed at the SDK boundary; the canonical evaluation is untouched.

val d: FlagDetail = flags.getFlagDetail("new_checkout")
d.value    // Boolean
d.reason   // one of the Reason constants

reason is one of the ai.shipeasy.Reason constants:

Reason constantMeaning
OVERRIDEA local override supplied the value (no telemetry).
CLIENT_NOT_READYSDK not initialized — no rules blob loaded yet.
FLAG_NOT_FOUNDThe gate name isn't present in the loaded blob.
OFFGate present but disabled / killed.
RULE_MATCHThe gate evaluated true (rules + rollout passed).
DEFAULTThe gate evaluated false.

getFlag is implemented on top of getFlagDetail and returns .value.

Boolean semantics

getFlag is strictly boolean. For typed values use configs; for variant assignment use experiments.

Was this page helpful?
✎ Edit this page

On this page