FeatureFlip

FeatureFlip module for the DevView developer tools suite.

This module provides feature flag management capabilities, allowing developers to toggle features on/off during development and testing. It supports both local features (device-specific) and remote features (controlled by remote configuration with local override capability).

Features

  • Local feature flags (simple on/off toggles)

  • Remote feature flags (remote config with local overrides)

  • Persistent state using DataStore

  • Search and filter capabilities

  • Real-time UI updates

  • Tri-state controls for remote features (Remote/Off/On)

Integration

The FeatureFlip module integrates with the DevView core framework as part of the FEATURES section. It provides navigation destinations and UI components that can be accessed through the DevView menu.

Module Configuration

val devView = DevView(
modules = listOf(
FeatureFlip,
// other modules...
)
)

Defining Features

val features = listOf(
Feature.LocalFeature(
name = "dark_mode",
description = "Enable dark theme",
isEnabled = false
),
Feature.RemoteFeature(
name = "new_checkout",
description = "New checkout flow",
defaultRemoteValue = true,
state = FeatureState.REMOTE
)
)

Using Features in Code

@Composable
fun MyScreen() {
val featureHandler = LocalFeatureHandler.current
val isDarkModeEnabled by featureHandler.isFeatureEnabled("dark_mode")

if (isDarkModeEnabled) {
DarkThemeContent()
} else {
LightThemeContent()
}
}

See also

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The DataStoreDelegate instance for the FeatureFlip module.

Link copied to clipboard
open override val dataStoreName: String
Link copied to clipboard
open override val destinations: PersistentMap<KClass<out NavKey>, DestinationMetadata>

Maps each navigation destination in this module to its DestinationMetadata.

Link copied to clipboard
open override val entryDestination: NavKey
Link copied to clipboard
open val icon: ImageVector
Link copied to clipboard
open val moduleName: String
Link copied to clipboard
open override val registerSerializers: PolymorphicModuleBuilder<NavKey>.() -> Unit

Registers serializers for navigation destinations.

Link copied to clipboard
open override val section: Section

The section this module belongs to in the DevView menu.

Link copied to clipboard
open val subtitle: String?

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun EntryProviderScope<NavKey>.registerContent(onNavigateBack: () -> Unit, onNavigate: (NavKey) -> Unit, bottomPadding: Dp)

Registers the composable content for each navigation destination.