setAttributesFromKeyValueLists function

void setAttributesFromKeyValueLists(
  1. Element element,
  2. List<String> attrsKeys,
  3. List<String?> attrsValues
)

Sets multiple attributes on element using a single JavaScript call.

This avoids multiple JS interop crossings by applying all attributes in one execution, improving performance — especially when running under WASM.

Each key in attrsKeys is paired with the value at the same index in attrsValues.

If a value is null, the corresponding attribute is removed.

Both lists must have the same length.

Implementation

void setAttributesFromKeyValueLists(
  Element element,
  List<String> attrsKeys,
  List<String?> attrsValues,
) {
  if (!_defined) _define();
  assert(attrsKeys.length == attrsValues.length);
  _setElementAttributesJS(
    element,
    attrsKeys.toJS,
    attrsValues.toJS,
  );
}