package Ġnl . ent re co . dart ss core card . faq Ċ Ċ import Ġandroidx . lifecycle . Lifecycle Owner Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . Observer Ċ import Ġnl . ent re co . dart ss core card . base . Base ViewModel Ċ import Ġnl . ent re co . domain . w tf . Subscribe To Wt fs Use case Ċ import Ġnl . ent re co . domain . w tf . W tf Item Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠW tf ViewModel Ġ@ Inject Ġconstructor ( private Ġval Ġsubscribe To W tf Use case : ĠSubscribe To Wt fs Use case ) Ġ: ĠBase ViewModel () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġitems : ĠMutable LiveData < List < W tf Item >> Ġ= ĠMutable LiveData () ĊĊĠĠĠ Ġprivate Ġfun Ġrefresh () Ġ{ ĊĠĠĠĠĠĠĠ Ġsubscribe To W tf Use case . subscribe ({ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġitems . value Ġ= Ġit ĊĠĠĠĠĠĠĠ Ġ}, Ġ{}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġsubscribe ( owner : ĠLifecycle Owner , Ġobserver : ĠObserver < List < W tf Item >>) Ġ{ ĊĠĠĠĠĠĠĠ Ġitems . observe ( owner , Ġobserver ) ĊĠĠĠĠĠĠĠ Ġrefresh () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġunsubscribe ( owner : ĠLifecycle Owner ) Ġ{ ĊĠĠĠĠĠĠĠ Ġitems . remove Observer s ( owner ) ĊĠĠĠĠĠĠĠ Ġitems . value Ġ= Ġempty List () ĊĠĠĠĠĠĠĠ Ġsubscribe To W tf Use case . unsubscribe () ĊĠĠĠ Ġ} Ċ }