postBytes method

  1. @override
Future<ParseNetworkResponse> postBytes(
  1. String path, {
  2. Stream<List<int>>? data,
  3. ParseNetworkOptions? options,
  4. ProgressCallback? onSendProgress,
  5. dynamic cancelToken,
})
override

Implementation

@override
Future<ParseNetworkResponse> postBytes(
  String path, {
  Stream<List<int>>? data,
  ParseNetworkOptions? options,
  ProgressCallback? onSendProgress,
  dynamic cancelToken,
}) async {
  final http.Response response = await _client.post(
    Uri.parse(path),
    //Convert the stream to a list
    body: await data?.fold<List<int>>(<int>[],
        (List<int> previous, List<int> element) => previous..addAll(element)),
    headers: options?.headers,
  );
  return ParseNetworkResponse(
      data: response.body, statusCode: response.statusCode);
}