搜索插件、代码仓与 APP 分类

GitHub 代码仓AndrewPiterov/event_bus_plus

event_bus_plus

AndrewPiterov/event_bus_plus open-source repository details.

event_bus_plus 项目封面
星标
15
复刻
10
最近推送(UTC)
2025年6月5日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

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)
Andrew GitHub avatar
GitHub 作者

Andrew ↗

Andrew Piterovon the Earth官方网站 ↗
语言DartC++CMakeHTMLSwiftCShellKotlinObjective-C

此仓库发布的插件

使用的依赖

依赖清单 8 项

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗