Functions as first-class objects
You can pass a function as a parameter to another function. For example:
1. void printElement(int element) {
2. print(element);
3. }
5. var list = [1, 2, 3];
7. // Pass printElement as a parameter.
8. list.forEach(printElement);
You can also assign a function to a variable, such as:
1. var loudify = (msg) => '!!! ${msg.toUpperCase()} !!!';
2. assert(loudify('hello') == '!!! HELLO !!!');
This example uses an anonymous function.More about those in the next section.
