-
Notifications
You must be signed in to change notification settings - Fork 8
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
Using Crimson with a generic class #9
Comments
This is not possible to support currently unfortuantely. The reason is that Crimson needs to know all possible types of Do you think something like this would be helpful: // define possible types of T
@json
typedef StringApiResponse = ApiResponse<String>;
@json
typedef ListApiResponse = ApiResponse<List<String>>;
void main() {
// use one of the generated decoders
Crimson(bytes).readStringApiResponse();
} Another option would be waiting for sealed class support in dart and requiring generic types to be subtypes of sealed classes. That would be problematic with What do you think @Reprevise? |
For my case specifically, it's not like I'm giving it a type and expecting it to parse it on its own as I'm providing it the method that it can parse it with as you can see with my |
Is there a reason you want to write the |
If you're talking about |
Discussed in #8
Originally posted by Reprevise December 31, 2022
I have a class like this:
I use it as so:
How can I do this with Crimson?
The text was updated successfully, but these errors were encountered: