MultiHandler constructor

MultiHandler(
  1. Iterable<Handler> handlers
)

Creates a new MultiHandler with given handlers.

Implementation

MultiHandler(Iterable<Handler> handlers)
    : _controller = StreamController.broadcast(sync: true) {
  if (handlers.isEmpty) {
    throw ArgumentError.value(
        handlers, 'handlers', 'Must be non empty iterable collection');
  }

  for (final h in handlers) {
    h.subscription = _controller.stream.listen(h.handle, onDone: h.close);
  }
}