fut_map 0.0.1 copy "fut_map: ^0.0.1" to clipboard
fut_map: ^0.0.1 copied to clipboard

outdated

Concurrent futures map

fut_map #

Map over futures in parlallel.

The problem with Future.all is that you have to start all futures at the same time. f_map allows you to control the concurrency over a list of futures.

Usage #

import 'dart:math';
import 'package:fut_map/fut_map.dart';

Future<int> delayedSquare(int x) async {
    await Future.delayed(Duration(milliseconds: Random().nextInt(2000)));
    return x * x;
};

void main()  {
  fmap([1,2,3,4,5,6,7,8,9], delayedSquare, parallel: 3).then((List<int> result) {
    print("Result $result");
  });
}