Dart Beginner - Anonymous Functions
void main() {
//Here we have a perfectly valid anonymous function, however it will not output to the screen.
(){print("Hello");};
//Next we need to build a list that will test our function.
List people = ["Joe","Jack","Bob"];
//Here we genericly print the list with a library function.
people.forEach(print);
print("---------------------------");
//Here I wanted to show just what passes and definitions the function uses.
people.forEach((name) {
print(name);
});
print("---------------------------");
people.where((name) {
switch(name){
case "Joe":
return true;
case "Jack":
return false;
case "Bob":
return true;
}
//Here we slighty tweaked the function to output only a select few of the values.
}).forEach(print);
}