Dart Deprecated field, how do you now add an event handler?

I have it...

query("#buttonCenter").on.click.add((event){
  OnButtonCenter(event);
});

Dart editor says that the field is out of date, I can’t find that he is “new”. Awful, I'm just having a bad night, it should be easy to understand, right?

Any help appreciated.

+5
source share
1 answer
query("#buttonCenter").onClick.listen((event){
  OnButtonCenter(event);
});

See New DOM Event Streaming API makes it easy to listen and record events for more details.

+12
source

All Articles