yash-agarwa-l commented on PR #3482:
URL: https://github.com/apache/fory/pull/3482#issuecomment-4161198307

   > Could we also support this pattern?
   > 
   > ```dart
   > @ ForyEnum()
   > enum UserRole {
   >   guest(0),
   >   member(1),
   >   admin(2);
   > 
   >   @ForyEnumId()
   >   final int code;
   > 
   >   const UserRole(this.code);
   > }
   > ```
   
   Yes, I had this in mind initially too. I went with per-value annotation 
because I feel the id is a metadata for values and since Dart enums don't 
support private fields, so the `foryId` ends up publicly accessible in user's 
code which felt a bit annoying. But I agree the field-based approach looks much 
cleaner for long enums. I'd be happy to change it if you prefer.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to