add method

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

Add a new route / update existing.

Parameters

  • IN name The new route name, must be unique. If a route with this name already exists, GemError.exist is returned.
  • IN waypoints Route waypoints list.
  • IN preferences Route preferences.
  • IN overwrite Overwrite route if name already exists.

If a route with given name already exists and overwrite = true, the existing route is updated.

Only route relevant preferences are saved: transport mode + avoid preferences.

Throws

  • An exception if it fails.

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,
    },
  );
}