user2019608
user2019608

Reputation:

How to dispatch events in Dart?

I read this question: How do I listen for custom events in Dart?

It tells you to dispatch events like:

window.on['foo'].dispatch(new CustomEvent('foo'));

However, with the latest version of Dart SDK, the on is deprecated. So how can I do this?

Upvotes: 1

Views: 714

Answers (1)

Kai Sellgren
Kai Sellgren

Reputation: 30212

The equivalent code in the latest SDK would be like:

window.dispatchEvent(new CustomEvent('foo'));

It does not need to be any harder than that ;)

Upvotes: 7

Related Questions