Location.fromMap constructor

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

It creates a Location object from a map.

Args: map (Map<String, dynamic>): The map that you want to convert to a Location object.

Returns: A new instance of the Location class.

Implementation

factory Location.fromMap(Map<String, dynamic> map) {
  return Location(
    street: map['street'] != null ? map['street'] as String : null,
    city: map['city'] != null ? map['city'] as String : null,
    state: map['state'] != null ? map['state'] as String : null,
    zip: map['zip'] != null ? map['zip'] as num : null,
  );
}