Search packages, repositories and app categories

Package detailsv0.7.0

event_bus_plus

Event Bus for Dart.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
5.2K
Likes
40
Pub points
130

Install package

flutter pub add event_bus_plus

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

EventBusPlus is a lightweight event bus implementation for Dart, enabling simple and efficient communication between objects in a Flutter application. It supports type-safe event broadcasting and subscription, making it ideal for decoupling components without tight dependencies. The package is designed for ease of use with clean APIs, allowing developers to emit events and listen to them across different parts of the app. It works seamlessly across all major platforms including Android, iOS, Web, macOS, Windows, and Linux.

Use cases

  • Decoupling UI components
  • Handling cross-widget communication
  • Managing app-wide state changes
  • Simplifying navigation events
  • Broadcasting notifications
  • Implementing plugin event systems

Key features

  • Type-safe event handling
  • Simple subscribe and emit API
  • Cross-platform compatibility
  • Lightweight and minimal overhead
  • Supports event cancellation
  • Clean and intuitive syntax

Suitable for

  • Developers seeking lightweight state management
  • Apps with frequent inter-component communication
  • Projects avoiding complex state solutions
  • Teams preferring pub-sub patterns
  • Prototyping rapid event-driven features

Considerations

  • Not suitable for large-scale state management
  • Limited built-in error handling
  • No persistence or serialization support
  • Best used alongside other state management approaches
  • May require careful cleanup to avoid memory leaks

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

EventBus: Events for Dart/Flutter

pub package codecov Dart

EventBus is an open-source library for Dart and Flutter using the publisher/subscriber pattern for loose coupling. EventBus enables central communication to decoupled classes with just a few lines of code – simplifying the code, removing dependencies, and speeding up app development.

event bus publish subscribe

Your benefits using EventBus: It…

  • simplifies the communication between components;
  • decouples event senders and receivers;
  • performs well with UI artifacts (e.g. Widgets, Controllers);
  • avoids complex and error-prone dependencies and life cycle issues.
event bus plus
Define the 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;

Mapping

final eventBus = bus = EventBus(
        map: {
          SomeEvent: [
            (e) => SomeAnotherEvent(),
          ],
        },
      );

Contributing

We accept the following contributions:

Maintainers

  • [Andrew Piterov](mailto:contact@andrewpiterov.com?subject=[GitHub]%20Source%20Dart%event_bus_plus)

Categories

Dependencies

Dependency list 4 items

Source repository

Projects using this package