Transformations with LiveData

About

Transformations class is provided if you want to make changes to the value stored in a LiveData object before dispatching it to the observers, or if you want to return a different LiveData instance based on the value of another one.
It is useful when you want to create chain reaction between LiveData or react to changes in another LiveData.

Transformations class provides 2 transformations out-of-box:

map is useful when you want to make changes to the value before dispatching it to the UI.

switchMap is useful when you want to return different LiveData based upon the value of the first one.

In this lesson, we will build a Pokemon app and use transformations to show the selected Pokemon in the PokemonDetailActivity

Something went wrong

Lesson added to
playlist

Create new playlist

We've got you covered

At Caster.IO we provide the best hyper focused & bite-sized development training available. Our goal is to
not waste your time, but to give more of it to you. From implementing a new pattern to learning a new technology,
we've got you covered.