event_bus_plus 0.3.0 event_bus_plus: ^0.3.0 copied to clipboard
Event Bus for Dart.
events_bus #
// Initialize the Service Bus
IAppEventBus eventBus = AppEventBus();
// Define your app event
final event = FollowEvent('@devcraft.ninja');
final event = CommentEvent('Awesome package 😎');
// listen the latest event
final sub = eventBus.last$.listen((AppEvent event) { /*do something*/ });
// fire the event
eventBus.fire(event);
// start watch the event till its completion
eventBus.watch(event);
// and check the progress
eventBus.isInProgress<FollowAppEvent>();
// or listen stream to check the processing
eventBus.inProgress$.map((List<AppEvent> events) =>
events.whereType<FollowAppEvent>().isNotEmpty);
// Listen particular event
eventBus.on<FollowAppEvent>().listen((e) {
// TODO: something
});
// complete
_eventBus.complete(event);
// or complete with completion event
_eventBus.complete(event, nextEvent: SomeAnotherEvent);
Contributing #
We accept the following contributions:
- Improving documentation
- Reporting issues
- Fixing bugs