package Ġcom . dic od ing . github user . view model Ċ Ċ import Ġandroid . app . Application Ċ import Ġandroidx . lifecycle . Android ViewModel Ċ import Ġandroidx . lifecycle . LiveData Ċ import Ġcom . dic od ing . github user . database . App Database Ċ import Ġcom . dic od ing . github user . database . User Favorite Dao Ċ import Ġcom . dic od ing . github user . database . User Favorite Entity Ċ Ċ class ĠF avorite ViewModel ( application : ĠApplication ): ĠAndroid ViewModel ( application ) Ġ{ ĊĠĠĠ Ġprivate Ġvar Ġfav Dao : ĠUser Favorite Dao ? Ġ= Ġnull ĊĠĠĠ Ġprivate Ġvar Ġdatabase : ĠApp Database ? Ġ= Ġnull ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġdatabase Ġ= ĠApp Database . get Database ( application ) ĊĠĠĠĠĠĠĠ Ġfav Dao Ġ= Ġdatabase ?. getUser Favorite Dao () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Favorite (): ĠLive Data < List < User Favorite Entity >> ? Ġ= Ġfav Dao ?. getAll () Ċ }