Programming in Dart: Functions & Closures
Jun 21 2022 · Dart 2.16, Flutter, DartPad
Part 1: Meet the Function
Hey what’s up everybody! This is Brian and welcome to Programming in Dart: Functions and Closures. In this course, we are going to be building on lessons that were learned in the Programming with Dart programming series.
When we last were on our Dart journey, we crossed through the lands of control flow and collections. You learned how to manage your programs and how to to store data. But now we are about to cross through the desert of functions and closures.
Well it’s not a desert of features mind you, because these two concepts will take your code to the next level. In fact, just think of desert as dessert because you are going to love all the features covered in this course.
In the previous Dart courses, you’ve learned how to write programs utilizing variables and control flow, but with functions, you’re going to be call that code on demand. In essence, the code that you’ve written was only accessible in one part of your program but now you are going to make them accessible to all the other parts.
This course into two parts.
In the first part, we’re going to start with an overview of functions and how to create them.
Once you have a good idea about functions, you’ll be introduced to optional parameters.
After which, you’ll learn about named parameters.
Then you’ll learn how to store a function in a variable and how you can pass it to other functions.
Then you’ll get an introduction to the typedef keyword which makes your code easier to read, especially when defining functions.
We’ll close out this course with an overview of arrow notation otherwise known as the fat arrow.
For this course, you don’t need to download any fancy programming tools. You’ll be doing all your Dart coding in a browser. This means you should have a modern browser like Firefox or Chrome.
This course is designed to be hands-on, where we’ll explore Dart together step-by-step. It’s very important that you don’t just watch the exercises, but actually follow along in Dartpad. This helps you understand how to write code in the Dart programming language.
In addition to what I just covered, the course contains several hands-on challenges, where you’ll get to practice what you’ve just learned on your own. It’s in your best interest to actually pause the video and try solving the challenges - you’ll learn a ton by doing this.
With that said, let’s start off by diving into the world of functions so crack those knuckles and I’ll see you in the next episode.