description

# fromFunctions<T extends JSAny?> static method

JSIterator<T> fromFunctions<T extends JSAny?>(

1. JSIteratorResult<T> next(), {
2. JSIteratorResult<T> returnValue()?,

})

Creates a proper JSIterator from the methods defined by the Iterator protocol.

This is the best way to create a custom JS iterator from Dart code. To convert an existing Dart iterable, use IterableToJSIterable.toJSIterable, and to convert an existing Dart iterator use IteratorToJSIterator.toJSIterator

## Implementation

    static JSIterator<T> fromFunctions<T extends JSAny?>(
      JSIteratorResult<T> Function() next, {
      JSIteratorResult<T> Function()? returnValue,
    }) {
      final iterator = _CustomIteratorProtocol<T>(next: next.toJS);
      if (returnValue != null) iterator._returnValue = returnValue.toJS;
      return from<T>(iterator);
    }