Anonymous Functions and Closures
Capture variables in inline functions.
Functions Without Names
Sometimes you need a function once and never again. An anonymous function has no name and is written right where you use it. ✨
The Basic Shape
An anonymous function is just parameters and a body, with no name in front. You can store it in a variable.
var greet = (String n) {
print('Hi ' + n);
};All lessons in this course
- Arrow Syntax for One-Line Functions
- Anonymous Functions and Closures
- Nullable Types and the Question Mark
- Null-Aware Operators: ?., ??, and !