events_emitter 0.0.2 events_emitter: ^0.0.2 copied to clipboard
A Event-based system, inspired by NodeJS's Event Emitter. Intuitive generic types to allow for multiple data types. Based on JavaScript and suitable for Dart and Flutter.
import 'package:events_emitter/events_emitter.dart';
void main() {
EventEmitter events = EventEmitter();
events.on('message', (String data) => print('String: $data'));
events.on('message', (int data) => print('Integer: $data'));
events.emit('message', 'Hello World');
events.emit('message', 42);
// [Output]
// String: Hello World
// Integer: 42
}