updateStyleProp<T extends StyleMethodPropConsumer> static method

void updateStyleProp<T extends StyleMethodPropConsumer>(
  1. T t,
  2. String key,
  3. Object value
)

Implementation

static void updateStyleProp<T extends StyleMethodPropConsumer>(
    T t, String key, Object value) {
  final provider = t.provider;
  final Map<String, StyleMethodProp>? methodMap = provider.styleMethodMap;

  if (methodMap != null) {
    var styleMethodHolder = methodMap[key];
    if (styleMethodHolder != null) {
      var realValue = checkValueType(value, styleMethodHolder.defaultValue);
      if (realValue != null) {
        styleMethodHolder.method(t, realValue);
      } else {
        styleMethodHolder.method(t, styleMethodHolder.defaultValue);
      }
    } else {
      if (value is VoltronMap && key == NodeProps.kStyle) {
        updateStyle(t, value);
      }
    }
  }
}