Documentation / dataflow / com.femastudios.dataflow / Field / transform
Go to reference


open fun <O> transform(transform: (T) -> O): Field<O>

Returns a new Field<O>, whose value is the transform applied to the value of this Field.

When the value of this Field changes, the value of the returned Field will change as well, according to transform.

For example:

val number = mutableFieldOf(10)
val isPositive /* : Field<Boolean> */= number.transform { it > 0 }
isPositive.value //Yields true
number.value = -5
isPositive.value //Yields false