3

Programming in Dart: Functions & Closures [SUBSCRIBER]

 2 years ago
source link: https://www.raywenderlich.com/30303825-programming-in-dart-functions-closures
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Meet the Function

Introduction

2:44 Free

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.

Use Functions

4:45 Free

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

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.

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

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.

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

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

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

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.

Learn Anonymous Functions & Closures

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

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

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

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

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

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

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

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

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

Next course in this Learning 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

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK