O'Reilly logo

Learning Dart by Ivo Balbaert, Dzenan Ridjanovic

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

Using functions in Dart

Functions are another tool for changing the control flow; a certain task is delegated to a function by calling it and providing some arguments. A function does the requested task and returns a value; the control flow returns where the function was called. In Java and C#, classes are indispensable and they are the most important structuring concept.

But Dart is both functional and object oriented. Functions are first-class objects themselves (they are of type Function) and can exist outside of a class as top-level functions (inside a class they are called methods). In prorabbits_v2.dart of Chapter 1, Dart – A Modern Web Programming Language, calculateRabbits is an example of a top-level function; and deposit, withdraw, and ...

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