update method

void update(
  1. int index, {
  2. String? name,
  3. List<Landmark>? waypoints,
  4. RoutePreferences? preferences,
})

Update an existing bookmarked route.

Only the fields provided will be updated; omit a parameter to leave the existing value intact.

Parameters

  • index: Index of the route to update in the current sort order.
  • name: Optional new unique name for the route. If a route with this name already exists the update will fail.
  • waypoints: Optional new list of Landmark waypoints.
  • preferences: Optional RoutePreferences to persist with the route.

Notes: Only route-relevant preferences (transport mode and avoid settings) are persisted.

Implementation

void update(
  final int index, {
  final String? name,
  final List<Landmark>? waypoints,
  final RoutePreferences? preferences,
}) {
  final LandmarkList landmarkList = waypoints == null
      ? LandmarkList()
      : LandmarkList.fromList(waypoints);

  objectMethod(
    pointerId,
    'RouteBookmarks',
    'update',
    args: <String, dynamic>{
      'index': index,
      'name': name ?? '',
      'waypoints': landmarkList.pointerId,
      'preferences': preferences ?? <String, dynamic>{},
      'hasName': name != null,
      'hasWaypoints': waypoints != null,
      'hasPreferences': preferences != null,
    },
  );
}