package Ġcom . j rod rig ue z va . rick and mort y kotlin . ui . favorite Ċ Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . viewModel Scope Ċ import Ġcom . j rod rig ue z va . rick and mort y kotlin . domain . model . Character Ċ import Ġcom . j rod rig ue z va . rick and mort y kotlin . domain . repository . R ick And M ort y Repository Ċ import Ġdagger . h ilt . android . lifecycle . H ilt ViewModel Ċ import Ġkotlinx . coroutines . flow . Flow Ċ import Ġkotlinx . coroutines . launch Ċ import Ġjavax . inject . Inject Ċ Ċ @ H ilt ViewModel Ċ class ĠF avorite ViewModel Ġ@ Inject Ġconstructor ( private Ġval Ġrepository : ĠR ick And M ort y Repository ) Ġ: ĠViewModel () Ġ{ ĊĊĠĠĠ Ġval Ġcharacters : ĠFlow < List < Character >> Ġget () Ġ= Ġrepository . get Character F avorites () ĊĊĠĠĠ Ġfun ĠonClick Favorite ( character : ĠCharacter ) Ġ{ ĊĠĠĠĠĠĠĠ ĠviewModel Scope . launch Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrepository . update Favorite ( character ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ