Country class
A class representing a country with its associated properties.
Constructors
-
Country({required String countryName, required String isoCode, required String dialCode, required String visualText, required String pattern, required String mask, required String emoji, required List<
int> areaCodes}) - Creates a Country object. All parameters are required.
-
Country.fromJson(Map<
String, dynamic> json) -
Creates a Country object from a JSON map.
Provides default values if certain keys are missing or null in the JSON.
factory
Properties
-
areaCodes
→ List<
int> -
A list of area codes for the country.
final
- countryName → String
-
The name of the country.
final
- dialCode → String
-
The international dialing code for the country (e.g., "+1" for United States).
final
- emoji → String
-
The emoji flag representing the country.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isoCode → String
-
The ISO code of the country (e.g., "US" for United States).
final
- mask → String
-
A mask pattern used for formatting phone numbers in this country.
final
- pattern → String
-
A regular expression pattern used to validate phone numbers for this country.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- visualText → String
-
A visual representation of the country, often including the dial code and ISO code.
final
Methods
-
getDefaultView(
) → String - Returns a default string representation for display purposes, typically combining the emoji flag and ISO code.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → String - Converts the Country object to a JSON string.
-
toMap(
) → Map< String, dynamic> - Converts the Country object to a Map<String, dynamic>.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited