Skip to content

How to serialize built-in enums to use index instead of name? #1286

Closed
@bambinoua

Description

@bambinoua

I have a class with internal enum ThemeMode. For example:

class Screen {
  Screen(this.mode);

  final ThemeMode mode;
}

How can I force to serialize mode as mode.index instead of default mode.name?
It is naturally I cannot annotate ThemeMode with JsonEnum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions