eventnotifier 1.0.0 copy "eventnotifier: ^1.0.0" to clipboard
eventnotifier: ^1.0.0 copied to clipboard

discontinuedreplaced by: event
outdated

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.

0
likes
0
pub points
0%
popularity

Publisher

verified publisheraryehoffman.com

Broadcasts named events to interested subscribers. When an event occurs, a method (callbacks) associated with the subscriber is executed.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on eventnotifier