Path.fromCoordinatesWaypoints constructor

Path.fromCoordinatesWaypoints({
  1. required List<Coordinates> coordinates,
  2. required List<int> waypoints,
})

Create a path from list of coordinates and waypoints.

Creates a Path from a list of Coordinates and a list of waypoint indices.

Waypoints are indices into the coordinates list

Parameters

  • coordinates: The list of Coordinates defining the path.
  • waypoints: A list of integer indices referencing positions in coordinates.

Returns

  • A new Path instance containing the provided coordinates and waypoints.

Implementation

factory Path.fromCoordinatesWaypoints({
  required List<Coordinates> coordinates,
  required List<int> waypoints,
}) {
  final String resultString = GemKitPlatform.instance.callCreateObject(
    jsonEncode(<String, Object>{
      'class': 'Path',
      'args': <String, dynamic>{
        'coords': coordinates,
        'waypoints': waypoints,
      },
    }),
  );
  final dynamic decodedVal = jsonDecode(resultString);

  return Path.init(decodedVal['result']);
}