Skip to content

Commit

Permalink
Update event_bus.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadaski authored Mar 26, 2019
1 parent e29b4a6 commit d6e494a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/event_bus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ class EventBus {
/// during a [fire] call. If false (the default), the event will be passed to
/// the listeners at a later time, after the code creating the event has
/// completed.
/// Also you can pass your own StreamController as EventBus to extend StreamController
/// such like Subject in RxDart.
///
EventBus({bool sync = false}) {
_streamController = new StreamController.broadcast(sync: sync);
EventBus({bool sync = false, StreamController controller}) {
_streamController = controller == null
? StreamController.broadcast(sync: sync)
: controller;
}

/// Listens for events of Type [T] and its subtypes.
Expand Down

0 comments on commit d6e494a

Please sign in to comment.