buffer_with_time

A stream transformer that buffers events based on a supplied time threshold


License
MIT

Documentation

Buffer With Time

A stream transformer that buffers events based on a supplied time threshold

Example

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

main() {
  var controller  = new StreamController();
  var transformer = new BufferWithTime(new Duration(seconds: 5));
  var buffered    = controller.stream.transform(transformer);

  // print the buffered results
  buffered.listen(print);

  // every second emit some data through
  new Timer.periodic(new Duration(seconds: 1), (_) {
    controller.add("I <3 streams");
  });
}