features/characters_favorites / com.vmadalin.dynamicfeatures.charactersfavorites.ui.favorite / CharactersFavoriteViewModel

CharactersFavoriteViewModel

class CharactersFavoriteViewModel : ViewModel

View model responsible for preparing and managing the data for CharactersFavoriteFragment.

See Also

ViewModel

Constructors

<init>

View model responsible for preparing and managing the data for CharactersFavoriteFragment.

CharactersFavoriteViewModel(characterFavoriteRepository: CharacterFavoriteRepository)

Properties

characterFavoriteRepository

val characterFavoriteRepository: CharacterFavoriteRepository

data

val data: LiveData<List<CharacterFavorite>>

state

val state: LiveData<CharactersFavoriteViewState!>

Functions

removeFavoriteCharacter

Remove the selected favorite character from database in case if exist.

fun removeFavoriteCharacter(character: CharacterFavorite): Unit