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.

Get The Dart Programming Language 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.