TransformationMutableLiveData
class TransformationMutableLiveData<T>(transformation: (T) -> T) : MutableLiveData<T>
Content copied to clipboard
A LiveData that applies a transformation to the value before setting it.
For transformations when reading LiveData, Transformations.map is more suitable. With two-way data binding that is not possible however and this class can be used.
For example this can be useful to restrict the value applied in the LiveData between a min and max value.
Constructors
Link copied to clipboard
fun <T> TransformationMutableLiveData(value: T, transformation: (T) -> T)
Content copied to clipboard
Link copied to clipboard