For simplicity, I'm rewriting my code to match a more canonical example of what the problem is.
So in dart, the Timer's constructor takes a duration and callback function as parameters. What if you want to pass a parameter to the callback function though?
Example:
Duration duration = const Duration(milliseconds: 3000);
Timer timer = new Timer(duration, callback)
void callback()
{
//do something...
}
That's an example of how it's worked for me in the past, but this time around what I really need it to do is something like this.
String tmp = document.query("#doc").innerHtml;
.....
...= new Timer(duration, callbackThatTakesAStringAsAParam(tmp));
void callbackThatTakeAStringAsAParam(String contents)
{
///do something with contents..
}
Obviously, the compiler throws a warning and the functionality is completely broken. I think the callback needs to be without the parentheses...that way it will defer the evaluation to later...but how would you do that without parentheses?
Thanks.