package Ġcom . cert ified . order . view . orders Ċ Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġcom . cert ified . order . model . Order Ċ Ċ class ĠOrder ViewModel Factory ( private Ġval Ġorders : ĠList < Order > ?) Ġ: ĠViewModel Provider . Factory Ġ{ ĊĠĠĠ Ġoverride Ġfun Ġ< T Ġ: ĠViewModel ?> Ġcreate ( model Class : ĠClass < T >): ĠT Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( model Class . isAssignableFrom ( Order ViewModel :: class . java )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠOrder ViewModel ( orders !! ) Ġas ĠT ĊĠĠĠĠĠĠĠ Ġthrow ĠIllegalArgumentException (" Unknown ĠViewModel Ġclass ") ĊĠĠĠ Ġ} Ċ }