DEV Community

Cover image for Lambda Functions in Dart
Baransel
Baransel

Posted on

11 2

Lambda Functions in Dart

Every function in dart is an object.

Functions that we use very often without a name are also called lambda functions.

Lambda functions are also called Arrow functions.

You can see usage example and output below.

Lambda Function Example Code

Follow my blog for more baransel.dev.

Top comments (3)

Collapse
 
nombrekeff profile image
Keff

Just wanted to clear something up. What is showcased in the example are not lambdas/anonymous functions, they are arrow functions. Although lambdas usually use the arrow syntax.

Arrow syntax function:

int test() => 123;
Enter fullscreen mode Exit fullscreen mode

Anonymous/lambda function:

items.map((item) => item.value);
Enter fullscreen mode Exit fullscreen mode
Collapse
 
baransel profile image
Baransel • Edited

Lambda functions are also called Arrow functions.

Collapse
 
nombrekeff profile image
Keff

Correct, lambdas use the arrow syntax, but at least in dart they only refer to anonymous/closure functions as lambdas. I've not seen arrow functions refered as such, at least in the dart language. Though they're called that in some other languages.

PD: no need to scream 😜

Billboard image

📊 A side-by-side product comparison between Sentry and Crashlytics

A free guide pointing out the differences between Sentry and Crashlytics, that’s it. See which is best for your mobile crash reporting needs.

See Comparison

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay