copyWith method

Theme copyWith({
  1. Set<ThemeLayerType>? types,
  2. String? id,
  3. double? atZoom,
})

Creates a copy of this theme with the specified properties. If specified, the returned theme only includes layers of the given types. If specified, the returned theme has the given id. If specified, the returned theme has only layers matching the given atZoom.

Implementation

Theme copyWith({Set<ThemeLayerType>? types, String? id, double? atZoom}) {
  return Theme(
      id: id ?? this.id,
      version: version,
      layers: layers
          .where((layer) => types?.contains(layer.type) ?? true)
          .where((layer) => atZoom == null || _matchesZoom(atZoom, layer))
          .toList(growable: false));
}