Programming in Dart: Functions & Closures

Jun 21 2022 · Dart 2.16, Flutter, DartPad

Part 2: Learn Anonymous Functions & Closures

14. Create a Closure

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 13. Challenge: Write an Anonymous Method Next episode: 15. Understand Generics

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Dart contains a cool feature that you can find in other languages - that is, you put a function inside of another function?

Function applyMultiplier(num multiplier) {

}
return (num value) {
    return value * multiplier;
};
var doubleMultiplier = applyMultiplier(2);
var tripleMultiplier = applyMultiplier(3);
var quadMultiplier = applyMultiplier(4);
print(doubleMultiplier(10));
print(tripleMultiplier(10));
print(quadMultiplier(10));