CountryCode class
A single country code item.
Contains a name, code, and dialCode.
CountryCodes are immutable and can be copied using copyWith and which are basically from List of Map<String, String> that are converted using the CountryCode.fromMap method.
You can also get the widget that contains the CountryCode's flag image by calling the flagImage getter method.
- Annotations
Constructors
- CountryCode({required String name, required String code, required String dialCode, int? nationalSignificantNumber})
-
A single country code item.
const
-
CountryCode.fromMap(Map<
String, dynamic> map) -
Converts the country code from map to the actual item.
factory
Properties
- code → String
-
The 2 character ISO code of the country.
final
- dialCode → String
-
The country dial code.
final
- flagImagePackage → String
-
Package to supply at Image widget if you're going to get
the raw flag image.
no setter
- flagUri → String
-
Uri of this CountryCode located at package's directory to supply
at Image widget if you're going to get the raw flag image.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- name → String
-
The name of the country.
final
- nationalSignificantNumber → int?
-
The number of digits that allow to uniquely identify a number
within the country. It excludes the country code and any trunk code or
access code. It includes the mobile prefix towards the total
number of digits.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{String? name, String? code, String? dialCode, int? nationalSignificantNumber}) → CountryCode - Returns a copy of this CountryCode with the given values updated.
-
flagImage(
{BoxFit? fit, double width = 32, AlignmentGeometry alignment = Alignment.center}) → CountryCodeFlagWidget - Gets the widget that can be used on displaying the selected country's flag.
-
localize(
BuildContext context) → CountryCode - Convenient getter for localized version of this country code.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
fromCode(
String? code) → CountryCode? -
Gets CountryCode based on the given country code.
Returns
null
if not found. -
fromDialCode(
String? dialCode) → CountryCode? -
Gets CountryCode based on the given dial code.
Returns
null
if not found. -
fromName(
String? name) → CountryCode? -
Gets CountryCode based on the given country name.
Returns
null
if not found.