decodeEndLocation static method

EndLocation? decodeEndLocation(
  1. Object? mapInput
)

Implementation

static EndLocation? decodeEndLocation(Object? mapInput) {
  if (mapInput == null || !(mapInput is Map?)) {
    return null;
  }

  try {
    Map map = mapInput as Map;

    String? id = map['id'];
    String? name = map['name'];
    String? description = map['description'];
    String? address = map['address'];
    var metadata = map['metadata'];
    String? recordedAt = map['recorded_at'];

    Map<String, dynamic>? geometryMap = map['geometry'];
    String? type = geometryMap?['type'];
    List? coordinates = geometryMap?['coordinates'];

    Geometry geometry = Geometry(type: type, coordinates: coordinates);
    EndLocation endLocation = EndLocation(id: id, name: name, description: description, address: address, metadata: metadata, recordedAt: recordedAt, geometry: geometry);
    return endLocation;
  } catch (error) {
    print('decodeEndLocation' + error.toString());
    return null;
  }
}