You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current chopper provides two ways to convert Request and Response.
The first version is to define the global default converter through the ChopperClient constructor. The second version is FactoryConverter annotation.
When we use both of them, the global default converter is ignored and the FactoryConverter is only being used.
Is there any plan to relay both of them?
For example,
voidSumfunction() {
final chopper =ChopperClient(
baseUrl:'https://jsonplaceholder.typicode.com',
services: [
TodosListService.create(),
],
converter:JsonConverter(),
);
}
classSomeChopperService {
// ...@Get(path:'/{id}')
@FactoryConverter(response: convertResponse)
Future<Response<Todo>> getTodo(@Path() int id);
}
Response<Todo> convertResponse<T, InnerType>(Response response) {
final body = response.body; // => body will be jsonMap by the relay of the `JsonConverter`return response.copyWith(body:Todo.fromJson(body));
}
If this is possible, converter can be Iterable like intercepter.
The text was updated successfully, but these errors were encountered:
Converter methods defined with @FactoryConverter will - by design - override the default converter. @FactoryConverter's intended usage is overriding the default converter behavior selectively for individual requests.
However, if null is passed to any of @FactoryConverter's parameters then Chopper should use the default converter for that conversion. This needs investigation.
The current
chopper
provides two ways to convertRequest
andResponse
.The first version is to define the global default converter through the
ChopperClient
constructor. The second version isFactoryConverter
annotation.When we use both of them, the global default converter is ignored and the
FactoryConverter
is only being used.Is there any plan to relay both of them?
For example,
If this is possible,
converter
can beIterable
likeintercepter
.The text was updated successfully, but these errors were encountered: