Before enums were available in Dart I wrote some cumbersome and hard to maintain code to simulate enums and now want to simplify it. I need to get the value of the enum as
This is your enum:
enum Day { monday, tuesday, }
Create an extension (may need to import 'package:flutter/foundation.dart';)
import 'package:flutter/foundation.dart';
extension DayEx on Day { String get inString => describeEnum(this); }
Usage:
void main() { Day monday = Day.monday; String inString = monday.inString; // 'monday' }