add method

void add(
  1. String name,
  2. List<Landmark> waypoints, {
  3. RoutePreferences? preferences,
  4. bool overwrite = false,
})

Adds a new route or updates an existing one in this bookmarks collection.

Stores a route identified by name together with its waypoints and optional preferences. When a route with the same name already exists the operation will fail unless overwrite is set to true, in which case the existing route is replaced.

Only route-relevant preference fields are persisted.

Parameters

  • name: Unique name identifying the route.
  • waypoints: Ordered list of Landmark objects defining the route.
  • preferences: Optional RoutePreferences to store with the route. If null, a default set of preferences will be used.
  • overwrite: When true, overwrite an existing route with the same name. Defaults to false.

Implementation

void add(
  final String name,
  final List<Landmark> waypoints, {
  final RoutePreferences? preferences,
  final bool overwrite = false,
}) {
  final LandmarkList landmarkList = LandmarkList.fromList(waypoints);

  objectMethod(
    pointerId,
    'RouteBookmarks',
    'add',
    args: <String, dynamic>{
      'name': name,
      'waypoints': landmarkList.pointerId,
      if (preferences != null) 'preferences': preferences,
      'overwrite': overwrite,
    },
  );
}