copyWith method

Feature<T> copyWith({
  1. Object? id,
  2. T? geometry,
  3. Map<String, dynamic>? properties,
  4. Map<String, dynamic>? custom,
})

Copy this feature with optional id, geometry, properties and custom properties.

When a new geometry is given, then the returned collection has bounds set to null.

Implementation

Feature<T> copyWith({
  Object? id,
  T? geometry,
  Map<String, dynamic>? properties,
  Map<String, dynamic>? custom,
}) =>
    Feature(
      id: id ?? this.id,
      geometry: geometry ?? this.geometry,
      properties: properties ?? this.properties,
      custom: custom ?? this.custom,

      // bounds set to null if new geometry set
      bounds: geometry != null ? null : bounds,
    );