updateProps method

void updateProps(
  1. VirtualNode node,
  2. VoltronMap? props,
  3. bool needToReset
)

Implementation

void updateProps(VirtualNode node, VoltronMap? props, bool needToReset) {
  if (props == null) {
    return;
  }
  final provider = node.provider;
  final Map<String, StyleMethodProp>? methodMap = provider.styleMethodMap;

  if (methodMap != null) {
    props.data.forEach((key, value) {
      var styleMethodHolder = methodMap[key];
      if (styleMethodHolder != null) {
        var realValue = checkValueType(value, styleMethodHolder.defaultValue);
        if (realValue != null) {
          styleMethodHolder.method(node, realValue);
        } else {
          styleMethodHolder.method(node, styleMethodHolder.defaultValue);
        }
      } else {
        if (value is VoltronMap && key == NodeProps.kStyle) {
          updateProps(node, value, false);
        }
      }
    });
  }
}