addUnconsumedDomProps method

void addUnconsumedDomProps(
  1. Map props,
  2. Iterable<PropsMeta> consumedProps
)

Copies DOM only key-value pairs from the provided props map into this map, excluding those with keys found in consumedProps.

consumedProps should be a Iterable<PropsMeta> instance. This is the return type of PropsMetaCollection's related APIs forMixins, allExceptForMixins, and all.

Example:

// within a functional component (wrapped in `uiFunction`)
// Consider props in FooProps "consumed"...
final consumedProps = [PropsMeta.forSimpleKey('className')];
// ...and filter them out when forwarding props to Bar.
return (Bar()..addUnconsumedDomProps(props, consumedProps))();

To add all unconsumed props, including DOM props, use addUnconsumedProps.

Related: UiComponent2's addUnconsumedDomProps

Implementation

void addUnconsumedDomProps(Map props, Iterable<PropsMeta> consumedProps) {
  final consumedPropKeys = consumedProps.map((consumedProps) => consumedProps.keys);
  forwardUnconsumedPropsV2(props, propsToUpdate: this, keySetsToOmit: consumedPropKeys, onlyCopyDomProps: true);
}