Country.fromMap constructor

Country.fromMap(
  1. Map<String, dynamic> map
)

It creates a Country object from a map.

Args: map (Map<String, dynamic>): The map that contains the data to be converted to a Country object.

Returns: A Country object

Implementation

factory Country.fromMap(Map<String, dynamic> map) {
  return Country(
    name: map['name'] != null ? map['name'] as String : null,
    dialCode: map['dial_code'] != null ? map['dial_code'] as String : null,
    code: map['code'] != null ? map['code'] as String : null,
  );
}