eventhandler 1.0.4

Flutter Android iOS web

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.

0
likes
110
pub points
66%
popularity

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

Documentation

API reference

Uploader

daniel.inigo.dev@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on eventhandler