addUnconsumedProps method

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

Copies 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 = props.staticMeta.forMixins({FooProps});
// ...and filter them out when forwarding props to Bar.
return (Bar()..addUnconsumedProps(props, consumedProps))();

To only add DOM props, use addUnconsumedDomProps.

Related: UiComponent2's addUnconsumedProps

Implementation

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