package Ġcom . pro ct . activities . in real . view models . category Ċ Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . viewModel Scope Ċ import Ġcom . pro ct . activities . in real . data . model . Category Ċ import Ġcom . pro ct . activities . in real . data . model . D ish Type Ċ import Ġcom . pro ct . activities . in real . utils . adapters . Category ViewModel Adapter Ċ import Ġcom . pro ct . activities . in real . utils . providers . Category And Dis hes ViewModel Provider Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . flow . first Ċ import Ġkotlinx . coroutines . launch Ċ import Ġkotlinx . coroutines . with Context Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠCategory ViewModel Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġvar Ġprovider : ĠCategory And Dis hes ViewModel Provider , ĊĠĠĠ Ġvar Ġadapter : ĠCategory ViewModel Adapter Ċ ) Ġ: ĠViewModel () Ġ{ ĊĊĠĠĠ Ġprivate Ġval Ġ_ categories List Ġ= ĠMutable LiveData < Mutable List < Category >>() ĊĠĠĠ Ġval Ġcategories List : ĠLive Data < Mutable List < Category >> ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġ_ categories List ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ ĠviewModel Scope . launch ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġlist Ġ= Ġadapter . getC ategories List (). first (). to Mutable List () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwith Context ( Dispatch ers . Main ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ_ categories List . post Value ( list ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset Type ( type : ĠD ish Type ) Ġ{ ĊĠĠĠĠĠĠĠ Ġprovider . setType ( type ) ĊĠĠĠ Ġ} Ċ } Ċ