I'm using the following code to have enum values and a corresponding string associated with it. I was wondering if there's a simpler way to accomplish this?
enum StyleType {
casual,
chic,
urban,
vintage,
punk,
}
class Style{
final StyleType type;
Style(this.type);
@override
String toString() {
switch (type) {
case StyleType.casual:
return 'Casual';
case StyleType.chic:
return 'Chic';
case StyleType.punk:
return 'Punk';
case StyleType.urban:
return 'Urban';
case StyleType.vintage:
return 'Vintage';
}
}
}