Hey @kevindmoore, The Article is just awesome
can we expect POST functionality soon or could you help us how to POST Data.
A POST shouldnât be too hard. You just need to have something like:
@Post(path: âcatsâ)
Future postData(@Body() String data);
Hey @kevindmoore , Thanks for this great article. Please Iâd to know it the ModelConverter works for any Model. Thx
You would have to change it to work with your models
Dear Kevin, thank you for the article. It helped me a lot. Thereâs a question about using several @Get paths. For example I also want to get /upcoming movies/
@Get(path: âmovie/upcomingâ)
Future<Response> getUpcomingMovies();
As far as I understand I should create a converter for each @Get() because I use different data there from different classes.
If I create a separate UpcomingModelConverter() I canât use it in static MovieService create() {
âŠ
converter: because I already have here ModelConverter() for popular movies
âŠ
}
Could you clarify how to make several requests and process them, please?
Great question. What I would do is in the ModelConverter class and in the decodeJson method, I would look at the json returned and see what type it is (by peeking into the string), then use a different classâs fromJSON method.
If that doesnât work, you could create a separate service for each return type.
Hi kevindmoore,
Thank you for this tutorial. I have an important piece of info for this one, and I suggest you update the tutorial with it.
I tried to make a post request and followed how you did it. The problem was with Interceptors. You see, the chopper will first call model converters and then Interceptors. So if we add an auth token as we do with this example, it will completely overwrite headers.
This might not always be a good thing and can lead to 4 hours of debugging like in my case 
My server was only ready to accept Content-type application/json, and nothing else. I specified it in a model converter and then added auth token in Intercepter.
So I copied your code.
Request newRequest = request.copyWith(headers: {
AUTH_HEADER: APIKEY,
});
return newRequest;
It erased my Content-type application/json and left it only with auth token. And then the underlying http client just filled Content-type in with the plain text.
the way I fixed it was using another method chopper:
@override
FutureOr onRequest(Request request) async {
return applyHeader(request, AUTH_HEADER, APIKEY);
}
this only adds headers and doesnât erase anything. The other way would be to specify the Content-type application/json here one more time.
For this tutorial, it doesnât make a big difference because TMDB API will forgive it, but other situations might not be ok with it.
I suggest you change a tutorial with applyHeader in onRequest of Interceptor or add a comment there to watch out.
Thank you!
Wow, thanks so much for the detailed suggestions. I will take a look as I do something similar in the Flutter book.