el function

ElementNode el(
  1. String name, {
  2. Object? key,
  3. Ref<Element?>? ref,
  4. Map<String, Object>? attributes,
  5. Map<String, Object>? listeners,
  6. Iterable<DeactNode>? children,
})

Creates an ElementNode node.

Every element has a name (e.g. 'div' or 'span'). This is a required parameter.

If you want to render a list of items as a list of elements it is important to set a key for every element, especially when items will be moved or later added to the start or middle. This prevents that different logical subtrees will be reused and the focus will correctly maintened.

When providing a Ref<Element>, the value of the reference will be set with the created element node.

Attributes of an element are provided as a map from an attribute name to the attribute value.

Event listeners of an element are provided as a map from the event name (e.g. 'onclick') to a EventListener.

The children of an element are provided as a list of DeactNodes.

Implementation

ElementNode el(
  String name, {
  Object? key,
  Ref<html.Element?>? ref,
  Map<String, Object>? attributes,
  Map<String, Object>? listeners,
  Iterable<DeactNode>? children,
}) {
  return ElementNode._(name, key, ref, attributes, listeners, children ?? []);
}