RemoteFeature
A feature flag controlled by a remote configuration service with local override capability.
Remote features allow you to control features from a remote configuration service (like Firebase Remote Config, LaunchDarkly, etc.) while also allowing developers and testers to override the remote value locally for testing purposes.
Feature States
Remote features support three states:
FeatureState.REMOTE: Use the defaultRemoteValue from remote configuration
FeatureState.LOCAL_ON: Force the feature ON regardless of remote configuration
FeatureState.LOCAL_OFF: Force the feature OFF regardless of remote configuration
Effective Enabled State
The isEnabled property returns the effective enabled state based on:
If state is REMOTE: returns defaultRemoteValue
If state is LOCAL_ON: returns true
If state is LOCAL_OFF: returns false
Usage Example
// Feature controlled by remote config
val newCheckout = Feature.RemoteFeature(
name = "new_checkout_flow",
description = "Enable the redesigned checkout experience",
defaultRemoteValue = remoteConfig.getBoolean("new_checkout_flow"),
state = FeatureState.REMOTE
)
// In the UI, users can override to test locally
// - Set to LOCAL_ON to force enable for testing
// - Set to LOCAL_OFF to force disable
// - Set back to REMOTE to use server value