0Pricing
Dart Academy · Lesson

Defining a Class With Fields

Bundle state into a class.

What a Class Is

A class is a blueprint for your own data type. It bundles related values together so you can model real things in code.

Your First Class

Declare a class with the class keyword and a capitalized name. The body, even if empty for now, lives inside the curly braces.

class Dog {
}

All lessons in this course

  1. Defining a Class With Fields
  2. Instance Methods and this
  3. Getters and Setters
  4. Static Members and Class Constants
← Back to Dart Academy