FeaturesBuilder

DSL builder for defining multiple Feature instances in a nested block.

Use this builder inside a ff4k or other DSL block to group feature definitions. You can add:

  • pre-built Feature objects,

  • collections of features, or

  • inline features using the DSL.

Example

val featureList = FeaturesBuilder().apply {
feature("dark-mode") {
isEnabled = true
}
feature(Feature("beta-feature", isEnabled = false))
features(listOf(
Feature("feature-1"),
Feature("feature-2")
))
}.build()

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun add(value: Feature)

Adds a value to the collector explicitly.

Link copied to clipboard
fun feature(feature: Feature)

Adds a pre-built Feature to this builder.

fun feature(uid: String, block: FeatureBuilder.() -> Unit)

Creates and adds a Feature inline using the DSL.

Link copied to clipboard
fun features(features: Collection<Feature>)

Adds a collection of Feature instances to this builder.

Link copied to clipboard
operator fun Feature.unaryPlus()

Adds this value to the collector.