Skip to main content

Feature Flag Methods

Methods for working with feature flags and A/B testing.

getFeatureFlag

Get the value of a feature flag. The value can be a boolean, string, number, or object.
string
required
Feature flag key.
FlagOptions
Optional configuration:
  • defaultValue: Default value if flag is not found
  • skipTracking: Skip automatic exposure tracking

Returns

T | undefined - The flag value, or undefined if not found and no default provided.

Example

isFeatureEnabled

Check if a feature flag is enabled (returns a boolean).
string
required
Feature flag key.
FlagOptions
Optional configuration:
  • defaultValue: Default value if flag is not found (defaults to false)
  • skipTracking: Skip automatic exposure tracking

Returns

boolean - true if the feature is enabled, false otherwise.

Example

getExperimentVariant

Get the assigned variant for an A/B test experiment.
string
required
Experiment key.
FlagOptions
Optional configuration:
  • defaultValue: Default variant if experiment is not found
  • skipTracking: Skip automatic exposure tracking

Returns

string | undefined - The variant key, or undefined if not found and no default provided.

Example

getAllFlags

Get all feature flags and experiments at once.

Returns

Record<string, FeatureFlag> - Object mapping flag keys to flag objects.

Example

reloadFeatureFlags

Manually reload feature flags from the server.
Record<string, any>
Optional updated user properties for targeting. If provided, flags will be re-evaluated with these properties.

Returns

Promise<void>

Example

Feature flags are automatically refreshed based on your configuration. You typically don’t need to manually reload them.

Feature Flags Guide

SoluteClient