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