Graphic constructor

Graphic(
  1. {Geometry? geometry,
  2. Map<String, dynamic> attributes = const {},
  3. ArcGISSymbol? symbol}
)

Creates a graphic with the given geometry, attributes, and symbol.

Parameters:

  • geometry — geometry. Can be null.
  • attributes — The attributes of the graphic. Can be null.
  • symbol — symbol. Can be null.

Implementation

factory Graphic(
    {Geometry? geometry,
    Map<String, dynamic> attributes = const {},
    ArcGISSymbol? symbol}) {
  _initializeArcGISEnvironmentIfNeeded();
  final coreAttributes = attributes.toDictionary(
      keyType: _ElementType.string, valueType: _ElementType.variant);
  final handle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_Graphic_createWithGeometryAttributesAndSymbol(
        geometry?._handle ?? ffi.nullptr,
        coreAttributes._handle,
        symbol?._handle ?? ffi.nullptr,
        errorHandler);
  });
  final Graphic object = Graphic._instanceCache.instanceWith(handle);
  object._attributes.value.setCache(attributes);
  object._symbol.cache(symbol);
  return object;
}