O'Reilly logo

The Dart Programming Language by Gilad Bracha

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

Functions are the workhorse of Dart. It is functions that actually compute things. We use the term functions loosely to cover functions and methods of all syntactic forms, regardless of whether they behave as mathematical functions or not.

Functions in Dart are first class values that can be stored in variables, passed as parameters and returned as results. Like all runtime values in Dart, functions are objects.

We have already encountered a variety of functions: top-level functions, instance and class methods (be they getters, setters, operators or vanilla methods) and constructors. As we shall see, there are also local functions and function literals. They all share common structure which we will illustrate here.

4.1 Parameters ...

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