toJson method

Map<String, dynamic> toJson()

Converts the DirectionRouteData to a Map with keys 'summary', 'segments', 'bbox', 'geometry', and 'way_points'.

The 'bbox' key is converted to a list of 4 doubles implying 2 coordinates.

Implementation

Map<String, dynamic> toJson() => <String, dynamic>{
      'summary': summary.toJson(),
      'segments': segments
          .map<Map<String, dynamic>>(
            (DirectionRouteSegment segment) => segment.toJson(),
          )
          .toList(),
      'bbox': [
        bbox[0].longitude,
        bbox[0].latitude,
        bbox[1].longitude,
        bbox[1].latitude,
      ],
      'geometry': geometry,
      'way_points': wayPoints,
    };