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
The DataStoreDelegate instance for the FeatureFlip module.
Maps each navigation destination in this module to its DestinationMetadata.
Registers serializers for navigation destinations.
Functions
Registers the composable content for each navigation destination.