updateFeature

open suspend override fun updateFeature(featureId: String, transform: (Feature) -> Feature)(source)

Update a feature using a transformation function.

This is a convenience method that reads the feature, applies the provided transformation, and saves the result back to the store atomically.

Implementations should ensure this operation is atomic to prevent race conditions.

Example:

store.updateFeature("my-feature") { feature ->
feature.copy(isEnabled = feature.isEnabled.not())
}

Parameters

featureId

Feature unique identifier

transform

Function to transform the feature

Throws

if feature doesn't exist