toIterable method

Iterable<Object?> toIterable()

Iterates this JSIterable, converting each element with dartify. See JSIterableToIterable.toDartIterable.

Implementation

Iterable<Object?> toIterable() {
  // `toDartIterable` fails for a primitive JS string (`Reflect.get` called
  // on non-object), so iterate its code points like JS does:
  if (isA<JSString>()) {
    return (this as JSString).toDart.runes.map(String.fromCharCode);
  }
  return toDartIterable.map((e) => e.dartify());
}