I am trying to set the response type in one of an API call to bytes
, but in retrofit I am not finding any option to set the response type.
I am using dio as http client.
@GET(API.blah_blah)
// I want to set the response Type I want to get, instead of json I need bytes
Future<dynamic> getSomething();
something like this in the generated file.
final _result = await _dio.request('some api url',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
// responseType: ResponseType.bytes,// this I have manually added
extra: _extra,
baseUrl: baseUrl),
data: _data);
Try this:
@GET(API.blah_blah)
@DioResponseType(ResponseType.bytes)
Future<HttpResponse<List<int\>>> getSomething();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With