doc / ch.tutteli.atrium.api.infix.en_GB / f

f

fun <T, R> MetaFeatureOption<T>.f(description: String, provider: R): MetaFeature<R> (source)

Creates a MetaFeature using the given provider and description.

This can be used to create complex features with a custom description or as workaround where Kotlin is not able to infer the types properly.

For instance:

expect(person) feature { f("first underage child", it.children.first { it < 18 }) }

Note that you can use feature of("first underage child") { children.first { it < 18 } } with the new type inference enabled (e.g. if you use Kotlin 1.4 or above). This method will most likely be removed once Kotlin 1.4 is out (probably with Atrium 1.0)

Return
The newly created MetaFeature.