CountryData class
Provides functionality to parse and convert country data from and to JSON.
This file contains the CountryData class which is used to model country data, including the country's name, dial code, and code. It provides methods to parse a JSON string into a list of CountryData instances and to convert a list of CountryData instances back into a JSON string.
Constructors
- CountryData({required String? name, required String? dialCode, required String? code})
-
Constructs a CountryData instance with the given
name
,dialCode
, andcode
. -
CountryData.fromJson(Map<
String, dynamic> json) -
Converts a JSON object into a CountryData instance.
factory
Properties
- code ↔ String?
-
The ISO code of the country.
getter/setter pair
- dialCode ↔ String?
-
The dial code of the country.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- name ↔ String?
-
The name of the country.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts a CountryData instance into a JSON object.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited