Place.fromMap constructor

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

Implementation

factory Place.fromMap(Map<String, dynamic> map) {
  final center = List<double>.from(map['center']);
  final latitudeValue = (center.length > 0) ? center[0] : 0.0;
  final longitudeValue = (center.length > 1) ? center[1] : 0.0;

  return Place(
    id: map['id'],
    type: map['type'],
    text: map['text'],
    placeName: map['place_name'],
    latitude: latitudeValue,
    longitude: longitudeValue,
  );
}