Address.fromMap constructor

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

Address.fromMap is a factory constructor that takes a Map<String, dynamic> and returns an Address object

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

Returns: A new instance of the Address class.

Implementation

factory Address.fromMap(Map<String, dynamic> map) {
  return Address(
    address1: map['address1'] as String?,
    address2: map['address2'] as String?,
    city: map['city'] as String?,
    postalCode: map['postalCode'] as String?,
    coordinates:
        Coordinate.fromMap(map['coordinates'] as Map<String, dynamic>),
    state: map['state'] as String?,
  );
}