Class Is a First-Order Concept

Dart’s classical approach to object-oriented programming is a significant, and welcome, departure from JavaScript’s prototype-based approach. Prototype-based languages certainly offer some benefits, but ease of approach is not one of them.

As you have seen, Dart classes are introduced with the class keyword.

classes/basics.dart
 
class​ ComicsCollection {
 
// describe class operations here...
 
}

That’s all we need in order to define a class in Dart—no fancy constructor functions, no heavy libraries to provide classical classes, just class followed by a class name.

Recipe 10 Although a class is a first-order concept in Dart, it is not a first-order object. As you saw in Chapter 6, Project: MVC in Dart, it is ...

Get Dart 1 for Everyone 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.