I read that enums are used for defining named constant values. But I dont get how it is different from a list in dart. Anyone cares to explain?


Solution 1: ZPrime

Enum is a user-defined data type. The built-in enum in dart stores an index, and a name with a string value.

Lists, on the other hand, can store objects. You can also add, remove and change values in lists, however, this is not allowed on enum.


Solution 2: Michael Ogundipe

An enum is used for defining named constants values. Constant values in the sense that once it is defined, it cannot be added to, removed or changed just as a const variable.

While a List on the other hand, is used to store objects too. Which can be manipulated such as add, remove and change the values in the list. Which is not allowed on enum.