Callable classes
A Callable class allows its instance to be called a function. This feature of Dart language helps make named functions.
You can use any class as a function. Just add a method call
to it.
void main() {
final mult = Multiplication(10);
print(mult(2)); // 20
print(mult(5)); // 50
print(mult(-10)); // -100
}
class Multiplication {
Multiplication(this.value);
final num value;
num call(num factor) => value * factor;
}