Object orientation in Dart
As with most modern languages, Dart is designed to be object-oriented (OO). As initially mentioned in Chapter 2, An Introduction to Dart, OOP languages are based on the concept of objects that hold both data (called fields) and code (called methods). These objects are created from blueprints called classes, which define the fields and methods an object will have.
The terms discussed here may be new to you, but the key areas will be covered in greater depth throughout the rest of this chapter. Let’s start with a brief overview of how Dart follows OOP principles.
Objects and classes
OOP arguably starts with Class
, which is effectively a blueprint of how data will be stored, accessed, and manipulated within your software program, and a way to compartmentalize the behavior of your software.
For example, if your app refers to football teams, then you may create a Class
definition called FootballTeam
. This Class
definition would define the data...