package Ġcom . nas in ha . digital space . developer . view model Ċ Ċ import Ġandroidx . lifecycle . ViewModel Ċ import Ġandroidx . lifecycle . live Data Ċ import Ġcom . nas in ha . digital space . developer . entity . Developer Entity Ċ import Ġcom . nas in ha . digital space . developer . repository . Developer Repository Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ Ċ class Ċ Developer ViewModel ( ĊĠĠĠ Ġprivate Ġval Ġrepository : ĠDeveloper Repository Ċ ) Ġ: ĠViewModel () Ġ{ ĊĊĠĠĠ Ġfun Ġadd Developer ( developer : ĠDeveloper Entity ) Ġ= Ġlive Data ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠ Ġrepository . add Developer ( developer ) ĊĠĠĠĠĠĠĠ Ġemit ( developer ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun ĠgetAll Developer () Ġ= Ġlive Data ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠ Ġemit ( repository . getAll ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdelete All () Ġ= Ġlive Data ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠ Ġrepository . delete All () ĊĠĠĠĠĠĠĠ Ġemit ( true ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġset All De velopers () Ġ= Ġlive Data ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdevelopers Ġ= Ġmutable ListOf < Developer Entity >() ĊĠĠĠĠĠĠĠ Ġrepository . set De velopers Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdevelopers . addAll ( it ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġemit ( developers ) ĊĠĠĠ Ġ} Ċ }