Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
in Android, the first thing you learn is to not use enums but use the @StringDef and @IntDef. But what is the alternative in Flutter for an enum?.
@StringDef
@IntDef
is there a way to create your stringdef version in Dart?
Enums are totally fine to use in Dart. You don't need an equivalent to StringDef.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
@IntDef
, it sounds like a premature optimization that a lot of people don't follow. As for Dart: github.com/dart-lang/language/issues/50