group_by_until 0.1.0 copy "group_by_until: ^0.1.0" to clipboard
group_by_until: ^0.1.0 copied to clipboard

Dart 1 only

A stream transformer for grouping events for a specified duration.

Group By Until #

A stream transformer for grouping events for a specified duration.

Example #

import 'dart:async';
import 'package:group_by_until/group_by_until.dart';

main() {
  var controller  = new StreamController();
  var transformer = new GroupByUntil(new Duration(seconds: 5), (n) {
    return n % 2;
  });
  var grouped = controller.stream.transform(transformer);
  var count   = 0;

  // print the grouped items together
  grouped.listen((stream) {
    stream.toList().then(print);
  });

  new Timer.periodic(new Duration(seconds: 1), (_) {
    controller.add(count++);
  });
}
0
likes
25
pub points
0%
popularity

Publisher

unverified uploader

A stream transformer for grouping events for a specified duration.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

More

Packages that depend on group_by_until