Arrow Function
- Dart has a special syntax for the function body, which is only one line. The arrow function is represented by \=> symbol. It is a shorthand syntax for any function that has only one expression.
Syntax
returnType functionName(parameters...) => expression;
By using fat arrow => the curly brackets needs to be removed. Otherwise, the code editor will show you an error.
If a function has a return type then by using a Fat arrow it is required to remove the return keyword.
ShortHand
Short hand expression is used to define a single expression in a function.
it is not used to multiple expression in a function.