allChildrenOfRegularElement function Null safety

List<ElementChild> allChildrenOfRegularElement(
  1. RegularElement el,
  2. Map<String?, RegularElement> definedOverrides,
  3. void onError(
    1. JaelError e
    )?,
  4. bool replaceWithDefault,
  5. bool anyTemplatesRemain
)

Implementation

List<ElementChild> allChildrenOfRegularElement(
    RegularElement el,
    Map<String?, RegularElement> definedOverrides,
    void Function(JaelError e)? onError,
    bool replaceWithDefault,
    bool anyTemplatesRemain) {
  var children = <ElementChild>[];

  for (var c in el.children) {
    if (c is Element) {
      children.addAll(replaceBlocks(c, definedOverrides, onError,
          replaceWithDefault, anyTemplatesRemain));
    } else {
      children.add(c);
    }
  }

  return children;
}