map<R> method

  1. @override
Future<Page<R>> map<R>(
  1. FutureOr<R> fn(
    1. T item
    )
)
override

Maps the type of the items to a different type. The same mapper function will be called on subsequent pages.

The implementation will call the fn in sequence, eagerly.

Implementation

@override
Future<Page<R>> map<R>(FutureOr<R> Function(T item) fn) {
  return mapItems((items) async {
    final list = <R>[];
    for (final item in items) {
      list.add(await fn(item));
    }
    return list;
  });
}