readBytes method

Future<List<int>?> readBytes({
  1. Map<String, dynamic> pathParams = const {},
  2. FutureOr onError(
    1. Response resp
    )?,
})

Implementation

Future<List<int>?> readBytes(
    {Map<String, dynamic> pathParams = const {},
    FutureOr<dynamic> onError(ht.Response resp)?}) async {
  ht.Response resp = await go(pathParams: pathParams);
  if (resp.isSuccess) {
    return resp.bodyBytes;
  }

  if (onError == null) {
    throw ErrorResponse(resp);
  }
  var err = await onError(resp);
  if (err != null) {
    throw err;
  }
  return null;
}