copy method

RoutePreferences copy()

Creates an independent deep copy of these preferences.

The returned RoutePreferences starts out with the same values as this instance but is fully independent — mutations on either side do not affect the other. Use this when you want to derive a variant of an existing configuration (for example to issue a slightly tweaked route calculation) without disturbing the original.

All scalar, enum, vehicle profile (car / truck / bike / EV), route range, geofence avoidance, and round-trip configuration is preserved, including internal sentinels that are not directly observable through the public API such as the avoidTurnAroundInstruction tri-state and the automatic / explicit timestamp flag.

The new instance is registered with the native auto-release machinery just like a factory-constructed one, so no manual disposal is required.

Returns

A new RoutePreferences whose fields equal those of this instance at the moment of the call.

Implementation

RoutePreferences copy() {
  final OperationResult result = objectMethod(
    pointerId,
    'RoutePrefWrapper',
    'copy',
  );
  return RoutePreferences.init(result['result']);
}