aryehof / dart-event

Create lightweight custom Dart Events, that allow interested subscribers to be notified that something has happened. Provides a notification mechanism across independent packages/layers/modules.
https://pub.dev/packages/event/
Apache License 2.0
20 stars 3 forks source link

Nullable event args #10

Closed ryuujo1573 closed 1 year ago

ryuujo1573 commented 1 year ago

Why event can be emitted without EventArgs? This is not ideal, for mainly non nullable values are used.

typedef EventHandler<T extends EventArgs> = void Function(T? args);

Emit an event without arguments is meaningless. I suggest use required positional argument T instead. For those cases void values are used, just use Event<SomeType?> on Event<T extends EventArgs?>

aryehof commented 1 year ago

Why event can be emitted without EventArgs?

Traditional MVC by convention has a view query the model after being notified that some event has occurred, rather than include whats changed/happened with the notification.