Country Data Source
Supplies the country list the picker displays.
Implement this to serve countries from somewhere other than the bundled dataset — a backend "supported markets" endpoint, a localized name provider, or a cut-down test fixture. The default implementation, DefaultCountryDataSource, is fully local so the picker works offline.
load is suspend so remote sources are natural; the default implementation returns immediately from an in-memory list and never touches disk or network.
A fun interface, so a one-off source is a lambda rather than an object declaration:
val source = CountryDataSource { api.supportedMarkets().map(::toCountry) }
val localized = CountryDataSource { DefaultCountryDataSource.localizedNames(Locale.current) }Content copied to clipboard