package Ġcom . example . xp mar vel . data . repositories Ċ Ċ import Ġcom . example . xp mar vel . data . local . map pers . Character Entity To Favorite Model Mapper Ċ import Ġcom . example . xp mar vel . data . local . source . Character Persistence Source Ċ import Ġcom . example . xp mar vel . domain . models . Favorite Character Model Ċ import Ġcom . example . xp mar vel . domain . repositories . Favorite Repository Ċ import Ġcom . example . xp mar vel . domain . repositories . Favorite Repository Failure Ċ import Ġcom . example . xp mar vel . utils . Either Ċ import Ġcom . example . xp mar vel . utils . Failure Ċ import Ġcom . example . xp mar vel . utils . map Ċ import Ġkotlinx . coroutines . Dispatch ers Ċ import Ġkotlinx . coroutines . with Context Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠF avorite Repository Impl Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġpersistence Source : ĠCharacter Persistence Source Ċ ) Ġ: ĠF avorite Repository Ġ{ ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġget Favorite Character (): ĠEither < Failure , ĠList < Favorite Character Model >> Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġwith Context ( Dispatch ers . IO ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmapper Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġpersistence Source . get Favorite Character () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. map Ġ{ ĠCharacter Entity To Favorite Model Mapper . map List ( it ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠEither . Right ( mapper ). b ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( ex : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠEither . Left ( Favorite Repository Failure . Persistence Error ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }