Chapter 4. Functional first-class functions and closures
This chapter covers
- Declaring functions and return types
- Specifying mandatory and optional parameters
- Storing first-class functions in variables
- Using functions as closures
Dart is similar in many ways to languages such as Java and C#, but its function syntax is more similar to that found in JavaScript than in more strongly typed languages. In Dart, everything is an object, including functions, which means you can store a function in a variable and pass it around your application the same way that you might pass a String, an int, or any other object. This is known as having first-class functions, because they’re treated as equivalent to other types and aren’t second-class citizens ...
Get Dart in Action now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.