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

App event handle event without using stream

app_event #

App event help manage events easily without using stream. You can manage the event by simply adding it to the required class.

sdcdc drawio

Usage #

1. Create Receiver #

  • Implement AppEventInterface you want to use
class Receiver implements AppEventInterface{
  @override
  onEventReceived(String eventName, value) {
    if(eventName == "testEvent"){
      //todo: update by event
    }
  }
}

2. Register Event #

  • Register your event name with your class implemented AppEventInterface
AppEvent.register("testEvent", Model);

3. Dispatch Event #

  • Dispatch your event When you want
AppEvent.dispatch("testEvent");

4. Receive Event #

  • There's nothing else you need to do. All pre-made onEventReceived functions are executed automatically.
@override
onEventReceived(String eventName, value) {
  if(eventName == "testEvent"){
      //todo: update by event
  }
}

5. Unregister Event #

  • When you no longer use the event, unregister event
AppEvent.unRegister("testEvent");
2
likes
130
points
16
downloads

Publisher

verified publisherconping.co.kr

Weekly Downloads

App event handle event without using stream

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on app_event