Splits a Stream of events into multiple Streams based on a set of predicates.
Using StreamRouter differs from Stream.where because events are only sent to one Stream. If more than one predicate matches the event, the event is sent to the stream created by the earlier call to route. Events not matched by a call to route are sent to the defaultStream.
import 'dart:html'; import 'package:quiver/async.dart';
var router = StreamRouter(window.onClick); var onRightClick = router.route((e) => e.button == 2); var onAltClick = router.route((e) => e.altKey); var onOtherClick router.defaultStream;
) → Future
Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
bool predicate(T event)) → Stream< T>
Events that match
predicateare sent to the stream created by this method, and not sent to any other router streams.
) → String
Returns a string representation of this object.