getPersistentRoadblockPathPreview static method

(List<Coordinates>, UserRoadblockPathPreviewCoordinate, GemError) getPersistentRoadblockPathPreview({
  1. required UserRoadblockPathPreviewCoordinate from,
  2. required Coordinates to,
  3. required RouteTransportMode transportMode,
})

Get persistent roadblock path preview

Parameters

  • IN coords The previous defined coordinates in roadblock path from where to start the preview
  • IN to The movable coordinate in roadblock path to where the preview ends
  • IN to The transport mode

Returns

  • The coordinates list preview of the roadblock path in from -> last order
  • The next roadblock point match suggestion
  • The error code. See the addPersistentRoadblockByCoordinates method for possible error codes for more details.

Throws

  • An exception if it fails

Implementation

static (List<Coordinates>, UserRoadblockPathPreviewCoordinate, GemError)
    getPersistentRoadblockPathPreview({
  required UserRoadblockPathPreviewCoordinate from,
  required Coordinates to,
  required RouteTransportMode transportMode,
}) {
  final OperationResult resultString = staticMethod(
    'TrafficService',
    'getPersistentRoadblockPathPreview',
    args: <String, dynamic>{
      'from': from,
      'to': to,
      'transportMode': transportMode.id,
    },
  );

  final List<Coordinates> coordinates =
      (resultString['result']['coords'] as List<dynamic>)
          .map((dynamic e) => Coordinates.fromJson(e))
          .toList();
  final UserRoadblockPathPreviewCoordinate previewCoordinate =
      UserRoadblockPathPreviewCoordinate.fromJson(
    resultString['result']['preview'],
  );
  final GemError error = GemErrorExtension.fromCode(
    resultString['result']['error'],
  );

  return (coordinates, previewCoordinate, error);
}