updateRoute method

Future<Route> updateRoute(
  1. String routeName, {
  2. String? newName,
  3. List<Waypoint>? waypoints,
  4. Map<String, dynamic>? extra,
})

Rename a route and/or replace its waypoints. Omitting waypoints leaves them unchanged; passing a list, including an empty one, replaces them.

// Example:
final route = await myNavigationService.updateRoute('patrol', waypoints: [Waypoint(location: 'kitchen')]);

For more information, see the navigation service docs.

Implementation

Future<Route> updateRoute(
  String routeName, {
  String? newName,
  List<Waypoint>? waypoints,
  Map<String, dynamic>? extra,
}) async {
  final request = UpdateRouteRequest(
    name: name,
    routeName: routeName,
    newName: newName,
    waypoints: waypoints == null ? null : WaypointList(waypoints: waypoints),
    extra: extra?.toStruct(),
  );
  final response = await client.updateRoute(request, options: callOptions);
  return response.route;
}