event_bus_plus 0.3.0+1 copy "event_bus_plus: ^0.3.0+1" to clipboard
event_bus_plus: ^0.3.0+1 copied to clipboard

Event Bus for Dart.

events_bus_plus #

event bus plus

Define app's events #

// Initialize the Service Bus
IAppEventBus eventBus = AppEventBus();

// Define your app events
final event = FollowEvent('@devcraft.ninja');
final event = CommentEvent('Awesome package 😎');

Subscribe #

// listen the latest event
final sub = eventBus.last$
        .listen((AppEvent event) { /*do something*/ });

// Listen particular event
final sub2 = eventBus.on<FollowAppEvent>()
        .listen((e) { /*do something*/ });

Publish #

// fire the event
eventBus.fire(event);

Watch events in progress #

// 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);

// complete
_eventBus.complete(event);

// or complete with completion event
_eventBus.complete(event, nextEvent: SomeAnotherEvent);

History #

final events = eventBus.history;

Contributing #

We accept the following contributions:

Maintainers #