mapi<B1, B2, C> method

Map<B1, B2> mapi<B1, B2, C>(
  1. MapEntry<B1, B2> mapper(
    1. A1 e1,
    2. A2 e2,
    3. int index,
    4. C? option,
    ), {
  2. List<C> options = const [],
})

Maps a map with an index and an optional option.

Implementation

Map<B1, B2> mapi<B1, B2, C>(
  MapEntry<B1, B2> Function(A1 e1, A2 e2, int index, C? option) mapper, {
  List<C> options = const [],
}) {
  var index = 0;
  return this.map((e1, e2) {
    final option = options.length > index ? options[index] : null;
    return mapper(e1, e2, index++, option);
  });
}