Programming in Dart: Functions & Closures

You’ll continue to build on the lessons taught in the Programming in Dart series by learning how to write functions to maximize code reuse as well as to filter and map collections. You’ll also be introduced to self-contained functions called closures to take your Dart code to the next level. By Brian Moakley.

Leave a rating/review
Download materials
Save for later

Learning path

This is part of the Flutter Fundamentals learning path. View path.

Who is this for?

This course is written for people who are new to programming! If you don’t know the difference between a function or an object, you’ve come to the right place.

Before starting, you should have watched Programming in Dart: Fundamentals and Programming in Dart: Control Flow & Collections. This course will build on those foundational concepts and expand on your understanding of the Dart programming language.

Covered concepts

  • Functions
  • Optional & named parameters
  • Function variables
  • Alias functions
  • Arrow notation
  • Anonymous functions
  • Closures
  • Generics

Part 1: Meet the Function

Toggle description

Gain an understanding of functions in Dart and then receive an overview of all the various concepts that will be covered in the first part of the course.

Toggle description

Meet the function! Learn how to define functions and then how to use them throughout your code.

Toggle description

Make your functions easier to use by providing options to the function caller. Of course, doing so requires you to write your parameters in a special way.

Toggle description

Named parameters make your function easier to use and easier to read. Learn how to define named parameters to make your code self documenting.

Toggle description

Now that you have a good idea about functions, your first challenge in this course is to write your very own function. Don’t worry - it’s not too hard.

Toggle description

One of the coolest parts of functions is storing them and passing them around like any other variable. This episode will get you started.

Toggle description

Learn how to define an alias to functions to make your them easier to both use & read.

Toggle description

Dart provides a nice little shortcut when writing functions called arrow notation. While it makes your functions easier to read, it raises questions about the void return type.

Conclusion 1:19
Toggle description

This episode wraps up the first part of this course, but things are just getting started. You’ll get a review of what was covered.

Part 2: Learn Anonymous Functions & Closures

Toggle description

In this next part, you’ll learn about creating anonymous functions and closures and the capabilities that they provide to your code.

Toggle description

Learn the basics of writing anonymous functions as well as why you’d even want to use them in the first place.

Toggle description

Put anonymous functions to use by using the map function and the filter function on Lists to both transform and filter values.

Toggle description

In this first challenge of the part, you’ll put your knowledge of anonymous methods to the test by filtering out a list.

Toggle description

Understand the basics of closures - why you’d use them and how they can maintain their own internal state.

Toggle description

Learn the theory behind the idea of generics; why it is useful and how it can make your easier to maintain.

Toggle description

Understand the basics of writing generic functions. That is, writing a function that can be used by many different types.

Toggle description

Now that you understand generics, you’ll put your new knowledge to the test by writing a method that filters a collection of numbers.

Conclusion 2:08
Toggle description

With this course complete, learn about some next steps as well as some additional resources to continue your Dart learning journey.

Up next

Flutter & Dart
Programming in Dart: Classes
In this final course in the Programming with Dart series, you’ll be introduced to one of the most importan... more



Brian Moakley


Adriana Kutenko


Nicolai Martelle Manaloto

Video Editor

Over 300 content creators. Join our team.