forEach

void forEach(

  1. JSAny? children,
  2. void fn(
    1. ReactElement child,
    2. int index
    )
)

Iterates over children, calling fn for each child.

Unlike map, forEach does not return anything.

Example:

Children.forEach(props['children'], (child, index) {
  print('Child $index: ${child.type}');
});

Implementation

static void forEach(
  JSAny? children,
  void Function(ReactElement child, int index) fn,
) {
  void jsIterator(JSObject child, JSNumber index) =>
      fn(ReactElement.fromJS(child), index.toDartInt);

_childrenForEach(children, jsIterator.toJS); }