copyWith method
OsmElement
copyWith(
{ - Map<String, String>? tags,
- int? id,
- int? version,
- LatLng? center,
- Geometry? geometry,
- IsMember? isMember,
- List<int>? nodes,
- Map<int, LatLng>? nodeLocations,
- bool currentTimestamp = false,
- bool clearMembers = false,
})
Implementation
OsmElement copyWith(
{Map<String, String>? tags,
int? id,
int? version,
LatLng? center,
Geometry? geometry,
IsMember? isMember,
List<int>? nodes,
Map<int, LatLng>? nodeLocations,
bool currentTimestamp = false,
bool clearMembers = false}) {
return OsmElement(
id: id != null ? OsmId(this.id.type, id) : this.id,
version: version ?? this.version,
timestamp: currentTimestamp ? DateTime.now().toUtc() : timestamp,
downloaded: downloaded,
tags: tags ?? this.tags,
center: center ?? this.center,
geometry: geometry ?? this.geometry,
nodes: clearMembers ? null : (nodes ?? this.nodes),
nodeLocations: clearMembers || (nodeLocations?.isEmpty ?? false)
? null
: (nodeLocations ?? this.nodeLocations),
members: clearMembers ? null : members,
isMember: isMember ?? this.isMember,
);
}