Understanding Dart Classes

In this chapter we will cover Dart classes, what constructors are, and how to create constructors for your classes. We’ll see named constructors, instance variables, and instance methods as well. Later we’ll see how inheritance works in Dart, and we’ll talk about static variables and methods.

As you know, Dart is an object-oriented language with classes and single inheritance. Everything in Dart is an object, including the built-in data types. An object is an instance of a class. To create an object, use the keyword new followed by the constructor of the class. See the following:

class Person {  Person() { ...

Get Web Programming with Dart now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.