This happened after migrating from Flutter 3.10.5 to 3.24.5.
I have a method on a class that uses a String with the information of what FontWeight to use. Basically, something like this:
final fontWightText = `w400`;
final fontWeight = FontWeight.values.firstWhere(
(element) => element
.toString()
.endsWith(fontWeightText),
),
The problem is that, while running the app on release mode, this throws a Bad state: No element error. If I run on debug, it works fine.
I noticed that if I print FontWeight.values.first on debug, I get FontWeight.w100, while on release I get Instance of 'FontWeight'.
I'm trying to find a workaround for this, but I also wonder if it might happen elsewhere on my app since it only happens if I run this new version of Flutter.

FontWeight.toStringshown in the Flutter 3.27.2 documentation, it does not seem to be one of them.