toMap method

  1. @override
Map<String, String> toMap()
override

Converts the parameters into a map representation.

Returns a Map object where the keys are the parameter names and the values are their corresponding string representations.

Implementation

@override
Map<String, String> toMap() {
  return {
    ...super.toMap(),
    "origin": origin.value,
    "destination": destination.value,
    if (waypoints != null && waypoints!.isNotEmpty)
      "waypoints": waypoints!.map((e) => e.value).join("|"),
    if (directionMode != null) "mode": directionMode!.name,
    if (avoids != null && avoids!.isNotEmpty)
      "avoid": avoids!.map((e) => e.name).join("|"),
    if (units != null) "units": units!.name,
  };
}