getBytes method
Future<ParseNetworkByteResponse>
getBytes(
- String path, {
- ParseNetworkOptions? options,
- ProgressCallback? onReceiveProgress,
- dynamic cancelToken,
override
Implementation
@override
Future<ParseNetworkByteResponse> getBytes(
String path, {
ParseNetworkOptions? options,
ProgressCallback? onReceiveProgress,
dynamic cancelToken,
}) async {
try {
final dio.Response<List<int>> dioResponse = await _client.get<List<int>>(
path,
cancelToken: cancelToken,
onReceiveProgress: onReceiveProgress,
options: _Options(
headers: options?.headers, responseType: dio.ResponseType.bytes),
);
return ParseNetworkByteResponse(
bytes: dioResponse.data,
statusCode: dioResponse.statusCode!,
);
} on dio.DioException catch (error) {
if (error.response != null) {
return ParseNetworkByteResponse(
data: error.response?.data ?? _fallbackErrorData,
statusCode: error.response?.statusCode ?? ParseError.otherCause,
);
} else {
return _getOtherCaseErrorForParseNetworkResponse(
error.error.toString());
}
}
}