package Ġcom . store maker . scan store . view models Ċ Ċ import Ġandroidx . lifecycle . Mutable LiveData Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . viewModel Scope Ċ import Ġcom . store maker . scan store . network . models . Users Ċ import Ġcom . store maker . scan store . repositories . UserRepository Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . launch Ċ Ċ class ĠLogin ViewModel : ViewModel (){ ĊĠĠĠ Ġprivate Ġval Ġuser Repository Ġ= ĠUser Repository () ĊĠĠĠ Ġval Ġuser From Single Query : Mutable LiveData < Users ?> Ġ= ĠMutable LiveData ( null ) ĊĊĠĠĠ Ġfun Ġretrieve User ( id : String , name : String ) Ġ= ĠviewModel Scope . launch Ġ( Dispatch ers . IO ){ ĊĠĠĠĠĠĠĠ Ġval Ġresp Ġ= Ġuser Repository . getUser ( id , name ). await () ĊĠĠĠĠĠĠĠ Ġif ( resp . is Successful ){ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġbody Ġ= Ġresp . body () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġuser From Single Query . post Value ( body !!. user ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }