notification_center
1.1.1, released 7 weeks ago by aky.dev
A simple event dispatch mechanism for broadcasting information to registered observers.
WASM-ready
What it does
It provides a centralized notification center using a singleton pattern. It enables broadcasting messages and type-safe payloads across your application with support for subscription management like pause, resume, and cancel.
AI-written summary of version 1.1.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to decouple components and broadcast events across the app
- You want a lightweight pub-sub event bus without heavy state management dependencies
Skip it when
- You prefer reactive stream-based solutions like standard Dart Streams or RxDart
- You need robust, enterprise-grade state containers or dependency injection frameworks
Strengths
- Type-safe payloads
- Subscription lifecycle controls (pause, resume, cancel)
- Zero heavy dependencies
Weaknesses
- Relies on a singleton pattern which can make testing more global
- Does not handle persistent storage or UI rendering widgets
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
NotificationCenter().subscribe<int>('updateCounter', (int data) {
print(data);
});
NotificationCenter().notify('updateCounter', data: 10);Alternatives
Packages that do the same job and could replace notification_center.