eventnotifier 1.0.0 eventnotifier: ^1.0.0 copied to clipboard
Broadcasts named events to interested subscribers. When an event occurs, a method (callbacks) associated with the subscriber is executed.
EventNotifier #
Broadcasts named events to interested subscribers. When an event occurs, a method (callback) associated with the subscriber is executed.
This is primarily intended to be mixed-in with a domain model to support change notifications.
Usage #
A simple usage example (see the test static EventNotifier method):
import 'package:eventnotifier/eventnotifier.dart';
main() {
var e = EventNotifier();
e.subscribe('myevent', (_) => print('boom'));
e.subscribe('myevent', (args) => print(args[0]));
assert(e.count() == 1);
assert(e.count('myevent') == 2);
e.notify('myevent', [99]);
// displays ...
// boom
// 99
}
Features and bugs #
Please file feature requests and bugs at the issue tracker.