events_emitter
An intuitive Event-based system, inspired by NodeJS's Event Emitter. Allows for multiple data types with type safety events. Based on JavaScript and suitable for Dart and Flutter.
0.6.0
36K downloads/mo
#1705 most downloaded on pub.dev
DrafaKiller/EventEmitter-dart
What this package is like to depend on
Last release 2 years ago
no release in 18 months
Ships unpredictably
gaps range from 3 weeks to 2.4 years
Nearly every release is documented
notes for 23 of 23 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
23 releases · first in 2022
0 releases in the last 12 months
see the full history below
Release timeline
23 releases · May 2022 to Jan 2025Releases
latest 23-
0.6.008 Jan 2025Release notes
Open source →[!]Changed:- Dart SDK constraint updated from
<3.0.0to<4.0.0 - Dependency
rxdartupdated from0.27.5to0.28.0
- Dart SDK constraint updated from
-
0.5.226 Aug 2022Release notes
Open source →Added:
- RestrictedEventEmitter for better control by allowing or disallowing specific event types, and the max listeners limit.
ListCallback.args1()to get the first argument of the list in a callback, added for consistency
Changed:
- Data property in
.emit()is optional, if no data is given the event will be of typeEvent<Null>which can still be caught byEventCallback<dynamic>
Fixed:
- Replaced
lintdeveloper dependency withlints
-
0.5.124 Aug 2022Release notes
Open source →Added:
- ListCallback, a helper class that when appended on
.on()lets you have multiple arguments. Essentially splitting a list eventEvent<List<dynamic>>into arguments, it's a workaround for the fact that Dart can't handle spread syntax. See [ListCallback] documentation.
- ListCallback, a helper class that when appended on
-
0.5.022 Aug 2022Release notes
Open source →[!]Removed:- Redundant
listenerreference of itself, in EventListener callbacks:onAdd,onRemove,onCallandonCancel. For simplicity and to avoiddynamiclistener's type issues. Usethisif possible, or a reference of the listener instead.
Fixed:
- EventListener callbacks documentation
- Main example
- Redundant
-
0.4.421 Aug 2022Release notes
Open source →Added:
- EventListener property
dataType
Fixed:
- Improved data type validation for
dynamicdata
- EventListener property
-
0.4.320 Aug 2022Release notes
Open source →Added:
- StreamEventListener, it's useful for having a streaming alternative to the default EventEmitter class
Fixed:
- Documentation with old property
topicnaming - EventListener callbacks would throw an exception in some cases when using dynamic
-
0.4.219 Aug 2022Release notes
Open source →Added:
-
cancelAddedparameter to EventListener, tells the listener to automatically remove itself from the added EventEmitter when the.cancel()method is called. This is used in case you want to add your own canceling method. It essentially appends callbacks to theonCancelcallbacks. -
.appendCallback()method to EventListener
[!]Changed:- Typedef EventAddedCallback renamed to EventCallbackAdd
- Typedef EventRemoveCallback renamed to EventCallbackRemove
- Typedef EventCancelCallback renamed to EventCallbackCancel
Fixed:
lintdependency moved to developer dependency
-
-
0.4.119 Aug 2022Release notes
Open source →Changed:
rxdartdependency updated from0.27.3to0.27.5
Fixed:
- Type matching in
.off() [!]Positional parameters in.off()changed to named parameters, as it was intended
-
0.4.018 Aug 2022Release notes
Open source →Added:
- EventListener properties
onceandprotectedadded - EventListener callbacks
onAdd,onRemoveandonCancel - EventListener handles custom events, they can also act like normal events. This is used to add context to an event if needed.
- EventEmitter
.on()can catch the data as well as the Event<T> of the data
[!]Changed:- EventStreamEmitter was renamed to StreamEventEmitter
- Event property topic renamed to type, to match JavaScript events
- Event property message renamed to data
- StreamEventEmitter's stream controller is now public
[!]Removed:- EventEmitter sync
- EventListener property
stream,subscriptionandmessageType
Massive BREAKING CHANGES:
-
EventEmitter was refactored to not depend on Streams, which means it now manages the callbacks itself. The emitter can have more complex listener logic. Before it would depend on StreamEventEmitter.
-
File structure was changed to be more organized. This means you might need to update your imports.
-
Sync is no longer a thing in the EventEmitter, it's a StreamEventEmitter only thing now.
-
Other changes:
[!]
- EventListener properties
-
0.3.108 Jun 2022 -
0.3.024 May 2022Release notes
Open source →Changed:
.onAnyinEventEmitternow returns anEventListener
Fixed:
- In some cases, canceled listeners didn't get removed, now it's more accurate
-
0.2.123 May 2022 -
0.2.022 May 2022Release notes
Open source →Added:
.emitEvent()emits an existing event, without having to create a new one
-
0.1.020 May 2022Release notes
Open source →Added:
rxdartpackage dependency, for better-implemented streams
Fixed:
- Cast with
dynamictype would break unexpectedly
-
0.0.720 May 2022 -
0.0.620 May 2022Release notes
Open source →Changed:
- Filter
.onAny<T>()by type
Fixed:
pubspec.yamlclean up- Example with
final
- Filter
-
0.0.519 May 2022Release notes
Open source →Changed:
onceinEventEmitternow returns aFuturewith the message, allowing toawait(still needs a callback)- Separated
EventEmitterandEventStreamEmitterclasses into different files - Internal variable names for simplification
Removed:
sendfor simplification, the same could be achieved withemit
-
0.0.5+119 May 2022Release notes
Open source →Added:
- More documentation (Why is this package different?)
Fixed:
- Documentation typos
-
0.0.5+219 May 2022Release notes
Open source →Changed:
- Package description and documentation for type safety promotion
-
0.0.418 May 2022 -
0.0.318 May 2022 -
0.0.218 May 2022Release notes
Open source →Changed:
onto return an EventListener, instead of a StreamSubscription
Fixed:
- Package description (was too long)
-
0.0.118 May 2022