eventhandler 1.0.4 copy "eventhandler: ^1.0.4" to clipboard
eventhandler: ^1.0.4 copied to clipboard

discontinued

Simple event handler with singleton constructor. An event is associated with each type of object that it inherits from EventBase.

EventHandler for dart #

Simple event handler with singleton constructor. An event is associated with each type of object that it inherits from EventBase.

Examples #

Implement custom event #

    class CustomEvent extends EventBase {}

Create a method that receives the custom event type #

    void _onCustomEventCallback(CustomEvent event) {
        print("CustomEvent received");
    }

Subscribe to the event #

  @override
  void initState() {
    EventHandler()
        .subscribe(_onCustomEventCallback);
    super.initState();
  }

Send event #

    RaisedButton(
        onPressed: () =>
            EventHandler().send(CustomEvent())              
    )

Remember unsubscribe to the event #

    @override
    void dispose() {
        EventHandler()
            .unsubscribe(_decreaseCounter);
        super.dispose();
    }

License #

This library is licensed under MIT.

2
likes
35
points
17
downloads

Publisher

unverified uploader

Weekly Downloads

Simple event handler with singleton constructor. An event is associated with each type of object that it inherits from EventBase.

Repository (GitLab)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on eventhandler