-
Notifications
You must be signed in to change notification settings - Fork 30
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
type 'String' is not a subtype of type 'Enum' in type cast #39
Comments
I was just coming in to report this, thanks. My map's key is an enum as well, so pretty much the exact case. |
Hello! Thank you for the report. JSON serialization and deserialization was kindly contributed by @knaeckeKami . Maybe he can help you. Or if you know how to fix this, I'm accepting PRs. The code that needs to be improved is at the very end of this file: Meanwhile, I have published version 7.4.1, which improves the error message. It will now be an unsupported error: Also, created a test for that, at the very end of this file: |
All keys in JSON are strings, so I don't understand why this code is here Also, why do the fast_immutable_collections/lib/src/imap/imap.dart Lines 407 to 415 in d5aca34
|
Hm, I don't see a way how this could be handled without a complete overhaul of serialization. But you can try using json_serializable_fic (https://pub.dev/packages/json_serializable_fic ). It says discontinued because I thought with the addition of the toJson, fromJson methods this package should be obsolete, but it should still work. There is a test for enum maps (https://github.com/knaeckeKami/json_serializable_immutable_collections/blob/master/builders/json_serializable_fic/test/integration/model_test.dart ). |
Error:
Minimal code:
The text was updated successfully, but these errors were encountered: