Enum from String
Mirrors aren’t always available, but fortunately you don’t need them. This is reasonably compact and should do what you want. enum Fruit { apple, banana } // Convert to string String str = Fruit.banana.toString(); // Convert to enum Fruit f = Fruit.values.firstWhere((e) => e.toString() == ‘Fruit.’ + str); assert(f == Fruit.banana); // it worked Thanks … Read more