Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 561 Bytes

prefer_function_declarations_over_variables.md

File metadata and controls

29 lines (22 loc) · 561 Bytes

Pattern: Missing use of function declaration to bind function to a name

Issue: -

Description

As Dart allows local function declarations, it is a good practice to use them in the place of function literals.

Example of incorrect code:

void main() {
 var localFunction = () {
  ...
 };
}

Example of correct code:

void main() {
 localFunction() {
  ...
 }
}

Further Reading