O'Reilly logo

Dart in Action by Chris Buckett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required