Programming in Dart: Functions & Closures

Jun 21 2022 · Dart 2.16, Flutter, DartPad

Part 1: Meet the Function

05. Challenge: Create a Function

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: 04. Understand Named Parameters Next episode: 06. Store a Function

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've reached locked video content where the transcript will be shown as obfuscated text.

At this point, you should feel pretty good idea about working with functions. So naturally, I have a challenge with you. In this episode, you’re going to get three challenges. So let’s get started.

String youAreWonderful
String youAreWonderful(String name) {

}
return 'You are wonderful, $name';
print(youAreWonderful('Douglas'));
String youAreWonderful(String name, int numberOfPeople) {
return 'You are wonderful, $name. $numberOfPeople people think so.';
print(youAreWonderful('Douglas', 10));
String youAreWonderful({ String name, int numberOfPeople } ) 
String youAreWonderful({ required String name, int numberOfPeople } ) 
String youAreWonderful({ required String name, int numberOfPeople = 30} ) 
print(youAreWonderful(name: 'Douglas', numberOfPeople: 10));
print(youAreWonderful(name: 'Jeremy'));