Anonymous functions in dart

Sometimes we need anonymous functions to use for once. Dart allows two similar syntax for writing these.

First one is when there is a single expression to write.

(a, b) => a + b

The other is when you need to write multiple statements in an anonymous functions.

(a, b) { return a + b; }

Comments