RemoteFeature

data class RemoteFeature(val name: String, val description: String?, val defaultRemoteValue: Boolean, val state: FeatureState) : Feature

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:

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

See also

Constructors

Link copied to clipboard
constructor(name: String, description: String?, defaultRemoteValue: Boolean, state: FeatureState)

Properties

Link copied to clipboard

The default value provided by the remote configuration service.

Link copied to clipboard
open override val description: String?

Optional human-readable description explaining what this feature does.

Link copied to clipboard
open override val isEnabled: Boolean

Whether the feature is currently enabled.

Link copied to clipboard
open override val name: String

The unique identifier name of the feature (e.g., "new_checkout_flow").

Link copied to clipboard

The current state controlling whether to use remote value or local override.