Sep 12, 2024
iCountryRepository
.withContext(Dispatchers.IO)
.CountryRepository
class.dispatcher
of type CoroutineDispatcher
to be used throughout the class.FilterCriteria
interface with a suspend fun filter(countries: List<Country>): List<Country>
.FilterByContinent
: Implements filtering by continent.FilterByDriveSide
: Implements filtering by drive side.FilterCriteria
interface.filterCountries
function in the CountryRepository
.FilterCriteria
object, which decides how to filter the list of countries.