0PricingLogin
Dart Academy · Lesson

Declaring and Using Plain Enums

Represent a fixed set of values.

A Fixed Set of Choices

Some values only ever come from a short, known list, like the days of the week. An enum names that fixed set of choices for you.

Declaring an Enum

You write enum, a name, then the allowed values inside braces. Each value is one constant member of that type.

enum Direction { north, south, east, west }

All lessons in this course

  1. Declaring and Using Plain Enums
  2. Enum Values, index, and name
  3. Enhanced Enums With Fields and Methods
  4. switch Over Enums Exhaustively
← Back to Dart Academy