Callable classes
To allow an instance of your Dart class to be called like a function,implement the call()
method.
In the following example, the WannabeFunction
class defines a call() functionthat takes three strings and concatenates them, separating each with a space,and appending an exclamation. Click Run to execute the code.