mapi<B, C> method

Iterable<B> mapi<B, C>(
  1. B mapper(
    1. A e,
    2. int index,
    3. C? option
    ), {
  2. List<C> options = const [],
})

Maps a set with an index and an optional option.

Implementation

Iterable<B> mapi<B, C>(
  B Function(A e, int index, C? option) mapper, {
  List<C> options = const [],
}) {
  var index = 0;
  return this.map((e) {
    final option = options.length > index ? options[index] : null;
    return mapper(e, index++, option);
  });
}