Lambda Expression in Flutter — Functional Programming
Hello folks, here we are discussing about the Lambda expression in Dart programming language.
What is Lambda expression?
Lambda expression is a function without a name, it is also called as anonymous function or just Lamda.
Dart is very cool programming language, it has lot of cool features and modern programming capabilities. Inside the dart, function is also a kind of an object as we define variables and objects in Dart.
Lambda Functions
Traditionally we define any function like this
we can convert same function in lambda function like this
As we know function in dart is an object so we can assign this function to object like
How to call Lambda functions
Call function variable name and pass the parameter to that object like
Write a function as expression
Further we can trim down the function into an expression, by using big fat arrow
this will print same result as previous function.
so that’s it guys, this is your lambda expression.
Thank you for reading :)