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 2. Objects, Interfaces, Classes and Mixins

It bears repeating: everything in Dart is an object. This includes even the simplest data such as numbers or the Boolean values true and false.

An object consists of a (possibly empty) set of fields, providing state, and a set of methods, providing behavior. The state of an object may be mutable or immutable. An object’s set of methods is never empty because all Dart objects have some behavior. Objects get their behavior from their class. Every object has a class; we say that the object is an instance of the class. Because every object has a class that determines its behavior, Dart is a class-based language.

Consider the Point class we encountered in the previous chapter.

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