removeGraphics method
void
removeGraphics({})
Removes the Graphics from a specific GraphicsLayer, given their removeByAttributeKey
with an removeByAttributeValue
.
If in this selection, there are Graphics that should not be deleted,
you cannot remove them using the key-value pair excludeAttributeKey
with excludeAttributeValues
.
For example, you want to remove all pins in the map, except the selected pin, then you remove the pin family and keep the selected pin using its id.
If removeByAttributeKey
is null, all graphics are removed.
For example, you want to remove all pins in the map of 'type' : 'pin', except the pins with the id 'basePin01' and 'highlightPin04', then write the following function.
controller.removeGraphics(
removeByAttributeKey: 'type',
removeByAttributeValue: 'pin',
excludeAttributeKey: 'id',
excludeAttributeValues: ['basePin01', 'highlightPin04'],
);
Implementation
void removeGraphics({
String? layerId,
String? removeByAttributeKey,
String? removeByAttributeValue,
String? excludeAttributeKey,
List<String>? excludeAttributeValues,
}) {
ArcgisMapPlatform.instance.removeGraphics(
mapId: mapId,
layerId: layerId,
removeByAttributeKey: removeByAttributeKey,
removeByAttributeValue: removeByAttributeValue,
excludeAttributeKey: excludeAttributeKey,
excludeAttributeValues: excludeAttributeValues,
);
}