CountryManager class

Centralized country data manager Handles data priority: Local overrides > API > Cache > Defaults

Constructors

CountryManager()
factory

Properties

countries Map<String, Country>
Get all available countries
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addCountry(Country country) → void
Add a new country (not in defaults)
clearOverrides() → void
Clear all overrides
getCountry(String code) Country?
Get a specific country by code
getCountryByCode(String code) Country?
Get country by country code (ISO)
getCountryByDialCode(String dialCode) Country?
Get country by dial code
getFlagByCountryCode(String? code) String
getFlagByDialCode(String? dialCode) String
getSortedCountries() List<Country>
Get countries sorted by name
initialize({CountryDataSource? remoteSource, List<Country> overrides = const []}) Future<void>
Initialize the manager
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
overrideAll(Map<String, Country> countries) → void
Override all countries at once
overrideCountry(Country country) → void
Override a specific country Throws exception if country code doesn't exist
refresh(CountryDataSource remoteSource) Future<void>
Refresh data from remote source
removeOverride(String countryCode) → void
Remove a specific override
reset() Future<void>
Reset to default countries (clears cache and overrides)
searchCountries(String query) List<Country>
Search countries by name or dial code
toString() String
A string representation of this object.
inherited
upsertCountry(Country country) → void
Upsert a country (add or override)
validatePhoneNumber(String phoneNumber, Country country) String?
Validate a phone number for a country

Operators

operator ==(Object other) bool
The equality operator.
inherited