set method

JSAny? set(
  1. Node node,
  2. JSAny? value
)

Sets the value of this local on the specified node to the value, and returns the specified value. This is often performed using selection.each:

selection.each((Element thisArg, JSAny? d, int i, List<Element?> nodes) {
  foo.set(thisArg, (d as JSBoxedDartObject)["value"]);
});

If you are just setting a single variable, consider using selection.propertySet:

selection.propertySet(
  foo.toString(),
  (Element thisArg, JSAny? d, int i, List<Element?> nodes) {
    return (d as JSBoxedDartObject)["value"];
  }.u21,
);

Implementation

JSAny? set(Node node, JSAny? value) {
  return (node as JSObject)[_] = value;
}