Programming in Dart: Functions & Closures [SUBSCRIBER]
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.
Meet the Function
Introduction
2:44 FreeGain 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 FreeMeet the function! Learn how to define functions and then how to use them throughout your code.
Implement Optional Parameters
5:37 FreeMake 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.
Store a Function
4:55One of the coolest parts of functions is storing them and passing them around like any other variable. This episode will get you started.
Understand Typedef
3:05Learn how to define an alias to functions to make your them easier to both use & read.
Use Arrow Notation
3:35Dart 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:19This 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
Introduction
0:56In 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.
Create a Closure
2:39Understand the basics of closures - why you’d use them and how they can maintain their own internal state.
Understand Generics
2:48Learn 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:08With 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
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK