encodeConfig static method

  1. @visibleForTesting
Map<String, dynamic> encodeConfig(
  1. SfSymbolConfig config
)

Encodes config for the native side.

Implementation

@visibleForTesting
static Map<String, dynamic> encodeConfig(SfSymbolConfig config) {
  return <String, dynamic>{
    'name': config.name,
    'size': config.size,
    // UIImage.SymbolWeight: ultraLight (1) ... black (9).
    'weight': config.weight.value ~/ 100,
    // UIImage.SymbolScale: small (1), medium (2), large (3).
    'scale': config.scale.index + 1,
    'renderingMode': config.renderingMode.name,
    'colors': [for (final color in config.colors) _hex(color)],
    if (config.variableValue != null)
      'variableValue': config.variableValue!.clamp(0.0, 1.0),
    if (config.effect != null) ...{
      'effect': config.effect!.name,
      'effectRepeats': config.effectRepeats,
    },
  };
}