event_handeler 0.0.1 copy "event_handeler: ^0.0.1" to clipboard
event_handeler: ^0.0.1 copied to clipboard

handel event like Javascript event APIs

event_handeler #

handel custom events just like JavaScript with some features and limitations #

event handeler is ment be used with your any function call,like if you run a function and on function end you will dispatchCustomEvent and it will notify its all listeners with addCustomEventListener

  • dispach custom events with value also
  • listen to it and get the value in a callback function
  • ✨Magic ✨

Features #

  • it can be used with your any function its very simple to use no need for any overhead of provider
  • simple data passing and listen for changes and act according to it in another file/class.
  • its a standalone function so you can use it any where no need for extras setup
  • it will marge with your any function and give it a new life who can emmit changes made,
  • when you add listener you can select which type/event you want to listen for
  • event listener can run customcallback with event value so data passing accross multiple pages made super easy .
  • multiple page support can be achived by utilizing local storage of device

I am somen das for any question or suggestions Email me also if you need an App 😉 Here is the

Methods #

dispatchCustomEvent(eventvalue,eventType) addCustomEventListener(eventType, callback)

callback have the value of eventvalue

Examples #

Install the dependencies and devDependencies and start.

For dispatching custom events when i add something to secureStorage

_storage .write(key: 'filterBy', value: "clear filters").then((value) {
dispatchCustomEvent("clear filters","filterChange");
});

To listen to this paricular event put this in initState under any function

addCustomEventListener("filterChange", (eventvalue){
print(eventvalue);//prints clear filters
//do something you want when the event happens
    
});
3
likes
125
pub points
2%
popularity

Publisher

verified publisherwebnima.in

handel event like Javascript event APIs

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on event_handeler