toJson method

  1. @override
Map<String, dynamic> toJson()
override

Converts the MPRouteLeg to a JSON representation that can be parsed by the MapsIndoors Platform SDK

Implementation

@override
Map<String, dynamic> toJson() {
  var jsonMPRouteSteps = steps?.map((e) => e.toJson()).toList();
  return {
    "start_address": startAddress,
    "end_address": endAddress,
    "start_location": startLocation?.toJson(),
    "end_location": endLocation?.toJson(),
    "steps": jsonMPRouteSteps,
    "distance": distance?.toJson(),
    "duration": duration?.toJson()
  };
}