symbolForGraphic method

ArcGISSymbol? symbolForGraphic(
  1. {required Graphic graphic,
  2. bool applyAttributeOverrides = false}
)

Returns the symbol that is used to visualize the given graphic with override attributes from the renderer.

If applyAttributeOverrides is set to true, this method will get the symbol from the renderer and override the symbol properties with the overrides available on the renderer. These include visual variable size, color, opacity and rotation. If the override expression or attributes contain any information not known to either the renderer or observation (such as "scale"), that override will not be applied. If the override attributes are applied successfully, a symbol with overridden properties will be returned otherwise the original symbol will be returned.

If the renderer is a DictionaryRenderer and its associated DictionarySymbolStyle references a style file hosted on ArcGIS Online or an ArcGIS Enterprise portal (also referred to as a web style), this method returns null. If the layer has rendered and the symbol is already drawn on the view, this method returns a valid MultilayerSymbol. If you want to get the symbol before the layer is rendered, use DictionarySymbolStyle.getSymbolAsync(Dictionary<String, Object>).

Parameters:

  • graphic — The graphic.
  • applyAttributeOverrides — Boolean value if set to true applies the override attributes from renderer.

Return Value: An ArcGISSymbol.

Implementation

ArcGISSymbol? symbolForGraphic(
    {required Graphic graphic, bool applyAttributeOverrides = false}) {
  final objectHandle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_Renderer_getSymbolForGraphicWithAttributeOverrides(
        _handle, graphic._handle, applyAttributeOverrides, errorHandler);
  });
  return ArcGISSymbol._fromHandle(objectHandle);
}