batching_future 1.0.0 copy "batching_future: ^1.0.0" to clipboard
batching_future: ^1.0.0 copied to clipboard

Batches multiple requests into a single batch requests which triggers once the maximum wait time or the maximum batch size is reached.

example/lib/main.dart

import 'dart:async';

import 'package:batching_future/batching_future.dart';

main(List<String> args) async {
  final batcher = createBatcher<int, int>((i) => i.map((i) => i * 2).toList(),
      maxBatchSize: 3, maxWaitDuration: Duration(milliseconds: 500));
  final inputs = [4, 6, 8];
  final futures = inputs.map((i) => batcher.submit(i));
  final results = await Future.wait(futures);
  print(results);
}
2
likes
40
pub points
0%
popularity

Publisher

unverified uploader

Batches multiple requests into a single batch requests which triggers once the maximum wait time or the maximum batch size is reached.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

BSD-2-Clause (LICENSE)

Dependencies

quiver, synchronized

More

Packages that depend on batching_future