How do you replace a listener in dart? -


i have class creates button , connects listener click event. in sub class i'd replace superclass handler. code adds listener:

row.query("[value='save']").onclick.listen(handlenewalert); 

how remove existing listener?

greg's answer describes how unsubscribe event source. correct, imo bit awkward, need keep subscription instance around in case derived class wants cancel it, or need provide method on base class if want hide details.

as want replace handler, understand providing different implementation, simpler approach simlpy override handlenewalert method in derived class.

of course, won't work if instead of method name have specified anonymous function, can't overridden, in scenario shown in example, might easier approach.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -