Skip to content
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

How to get the typed data when make a request? #6

Closed
CurrySenpai opened this issue Jul 14, 2020 · 2 comments
Closed

How to get the typed data when make a request? #6

CurrySenpai opened this issue Jul 14, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@CurrySenpai
Copy link

currently i am doing this

    final WPResponse response = await api.getPosts();
    final List<PostSchema> posts =
        (response.data as List).map((e) => PostSchema.fromJson(e)).toList();

is there a less boilerplate way and safe?

thank you

@theeomm
Copy link
Member

theeomm commented Jul 14, 2020

Will take this as a suggestion as this wasn't thought of when adding the schemas. Thank you for your contribution

@theeomm theeomm added the enhancement New feature or request label Jul 19, 2020
@theeomm
Copy link
Member

theeomm commented Jul 22, 2020

This has been done in the latest release. Thanks for the suggestion once more

@theeomm theeomm closed this as completed Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants