0

A simple question here :) I'm really happy to see a new feature in the dart language. But I just realized that I kind of never use enumeration.I don't know if there is a discussion somewhere about that but.

What is the pros and cons of this feature in terms of code writing (seems shorter), performance,etc? Cheers

BenNG
  • 531
  • 1
  • 4
  • 12

1 Answers1

0

If I understand it correctly an enum is like a class with const members and some useful methods. Given that cost members are resolved by the compiler using an enum should not incur in any performance hit.

In terms of "code writing" enums are good candidates to replace classic const or static enumerations or, even better, hard-coded constants.

fog
  • 3,266
  • 1
  • 25
  • 31