update method
- int index, {
- String? name,
- List<
Landmark> ? waypoints, - 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. An empty list leaves them unchanged.preferences: Optional RoutePreferences to persist with the route.
Notes: Only route-relevant preferences (transport mode and avoid settings) are persisted.
Returns
- GemError.success on success
- GemError.exist if
nameis already used by another route - GemError.notFound if
indexdoes not identify a route - GemError.invalidInput if
nameis empty - GemError.general if the route could not be stored
Implementation
GemError update(
int index, {
String? name,
List<Landmark>? waypoints,
RoutePreferences? preferences,
}) {
final LandmarkList landmarkList = waypoints == null
? LandmarkList()
: LandmarkList.fromList(waypoints);
final OperationResult result = objectMethod(
pointerId,
'RouteBookmarks',
'update',
args: <String, dynamic>{
'index': index,
'name': name ?? '',
'waypoints': landmarkList.pointerId,
'preferences': preferences?.pointerId,
'hasName': name != null,
'hasWaypoints': waypoints != null,
'hasPreferences': preferences != null,
},
);
return GemErrorExtension.fromCode(result['result']);
}