addEach<T> method

DOMNode addEach<T>(
  1. Iterable<T> iterable, [
  2. ContentGenerator<T>? contentGenerator
])

Adds each entry of iterable to content.

contentGenerator Optional element generator, that is called for each entry of iterable.

Implementation

DOMNode addEach<T>(Iterable<T> iterable,
    [ContentGenerator<T>? contentGenerator]) {
  if (contentGenerator != null) {
    for (var entry in iterable) {
      var content = contentGenerator(entry);
      _addImpl(content);
    }
  } else {
    for (var entry in iterable) {
      _addImpl(entry);
    }
  }

  normalizeContent();
  return this;
}