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

outdatedDart 1 only

An easy to use event dispatching API

Event Dispatcher #

An elegant event system.

By using an event system methods can subscribe to a controller to listen to events. Events allow for handling many different parts of the codebase without needing to directly call them. The event dispatcher does all the calling once an event is posted.

Example #

import 'package:event_dispatcher/event_dispatcher.dart';

void main() {
  
  void generic(GenericEvent e) {
    print("Generic event called");
  }
  
  void specific(Event e) {
    print("Specific event called");
  }

  var ed = new EventDispatcher();
  ed.register(generic);
  ed.register(specific);
  
  ed.post(new GenericEvent());
  ed.post(new Event());
  
  print("");
  
  ed.unregister(generic);
  
  ed.post(new GenericEvent());
  ed.post(new Event());
}

class GenericEvent {}

class Event extends GenericEvent {}
0
likes
0
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

An easy to use event dispatching API

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on event_dispatcher