Skip to content

Gracefully handle unsupported enum values #838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
via-guy opened this issue Mar 18, 2021 · 3 comments
Closed

Gracefully handle unsupported enum values #838

via-guy opened this issue Mar 18, 2021 · 3 comments

Comments

@via-guy
Copy link

via-guy commented Mar 18, 2021

Currently when an unsupported enum value is found the decoder throws an ArgumentError. This can completely break an app in production when an enum value is added to the server.

Currently the only option is to add an xUnknown value to each enum, which seems completely unnecessary for a nullable value.

It would be great to either add a new property to JsonKey, e.g. allowUnsupportedEnumValue, or handle the same logic if both nullable == true and unknownEnumValue == null.

Flutter 1.22.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 9b2d32b605 (8 weeks ago) • 2021-01-22 14:36:39 -0800
Engine • revision 2f0af37152
Tools • Dart 2.10.5
@jeiea
Copy link

jeiea commented May 6, 2021

Is it a duplicate of #559?

@via-guy
Copy link
Author

via-guy commented May 6, 2021

@jeiea I guess it is.

@kevmoo
Copy link
Collaborator

kevmoo commented Jul 13, 2021

Duplicate of #559

@kevmoo kevmoo marked this as a duplicate of #559 Jul 13, 2021
@kevmoo kevmoo closed this as completed Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants