Arrow Syntax for One-Line Functions
Shorten functions with the fat arrow.
Why Shorten Functions?
Many Dart functions just return one expression. The arrow syntax lets you write those in a single tidy line. ✨
The Fat Arrow
The => symbol, called the fat arrow, replaces the curly braces and the return keyword for one-expression bodies.
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 !