>>121Read up on List/Haskell and functional programming. Lamdas are a crucial feature for certain functional styles of doing things.
If you're familiar with underscore.js, or Ruby's blocks, you'll know why they're useful.
Example:
// JS with Underscore
var squares = _.map([1,2,3,4,5], function(i) {
return i*i;
});
// instead of
var squares = [];
for (var i=0; i < 5; i++) {
squares.push(i*i);
}
// which can be useful for a lot of things.
———————–
#Here's the same thing in Ruby:
squares = []
(5).times do |i|
squares << i*i
end
# or a more useful example
File.open('something.txt') do |file|
#do something with file…
end
# Ruby 'blocks' are lambdas
————————-
// and back in dart
var squares = [1,2,3,4,5].map((i) => i*i);
So no, it's not just 'syntactic sugar', they're useful constructs.