createDirectionsRequest function

DirectionsRequest createDirectionsRequest(
  1. dynamic arguments
)

Implementation

DirectionsRequest createDirectionsRequest(arguments) {
  String? poiToIdentifier;
  Map directionsRequestArgs = arguments["directionsRequest"];
  if (!directionsRequestArgs.containsKey("poiToIdentifier") &&
      arguments["destinationCategory"] == "POI") {
    poiToIdentifier =
        stringFromArgsOrEmptyId(arguments, "destinationIdentifier");
  }
  var directionsRequest = DirectionsRequest(
    from: createPoint(directionsRequestArgs["from"]),
    to: createPoint(directionsRequestArgs["to"]),
    poiToIdentifier: poiToIdentifier,
    bearingFrom: Angle.fromRadians(
      (directionsRequestArgs["bearingFrom"] != null
              ? directionsRequestArgs["bearingFrom"]["radians"]
              : 0)
          .toDouble(),
    ),
    minimizeFloorChanges: directionsRequestArgs["minimizeFloorChanges"],
    originIdentifier: stringFromArgsOrEmptyId(arguments, "originIdentifier"),
    originCategory: arguments["originCategory"],
    destinationIdentifier:
        stringFromArgsOrEmptyId(arguments, "destinationIdentifier"),
    destinationCategory: arguments["destinationCategory"],
  );
  directionsRequest.accessibilityMode =
      createAccessibilityMode(directionsRequestArgs);
  return directionsRequest;
}