UniqueValueRenderer constructor

UniqueValueRenderer(
  1. {List<String> fieldNames = const [],
  2. List<UniqueValue> uniqueValues = const [],
  3. String defaultLabel = '',
  4. ArcGISSymbol? defaultSymbol}
)

Creates a new unique value renderer object.

Parameters:

  • fieldNames — A collection of the field names/attribute keys that the unique values apply to.
  • uniqueValues — A collection of unique values used by the renderer to select a symbol.
  • defaultLabel — The label used for the default symbol.
  • defaultSymbol — The default symbol for values that don't match any of the unique values.

Implementation

factory UniqueValueRenderer(
    {List<String> fieldNames = const [],
    List<UniqueValue> uniqueValues = const [],
    String defaultLabel = '',
    ArcGISSymbol? defaultSymbol}) {
  _initializeArcGISEnvironmentIfNeeded();
  final coreFieldNames =
      fieldNames.toMutableArray(valueType: _ElementType.string);
  final coreUniqueValues =
      uniqueValues.toMutableArray(valueType: _ElementType.uniqueValue);
  final coreDefaultLabel = _CString(defaultLabel);
  final handle = _withThrowingErrorHandler((errorHandler) {
    return runtimecore.RT_UniqueValueRenderer_createWith(
        coreFieldNames._handle,
        coreUniqueValues._handle,
        coreDefaultLabel.bytes,
        defaultSymbol?._handle ?? ffi.nullptr,
        errorHandler);
  });
  final UniqueValueRenderer object =
      Renderer._instanceCache.instanceWith(handle);
  object._fieldNames.value.setCache(fieldNames);
  object._uniqueValues.value.setCache(uniqueValues);
  object._defaultSymbol.cache(defaultSymbol);
  return object;
}