getEncodedResponse method

Future<GetEncodedResponseResult> getEncodedResponse(
  1. RequestId requestId,
  2. @Enum(['webp', 'jpeg', 'png']) String encoding, {
  3. num? quality,
  4. bool? sizeOnly,
})

Returns the response body and size if it were re-encoded with the specified settings. Only applies to images. requestId Identifier of the network request to get content for. encoding The encoding to use. quality The quality of the encoding (0-1). (defaults to 1) sizeOnly Whether to only return the size information (defaults to false).

Implementation

Future<GetEncodedResponseResult> getEncodedResponse(
  network.RequestId requestId,
  @Enum(['webp', 'jpeg', 'png']) String encoding, {
  num? quality,
  bool? sizeOnly,
}) async {
  assert(const ['webp', 'jpeg', 'png'].contains(encoding));
  var result = await _client.send('Audits.getEncodedResponse', {
    'requestId': requestId,
    'encoding': encoding,
    if (quality != null) 'quality': quality,
    if (sizeOnly != null) 'sizeOnly': sizeOnly,
  });
  return GetEncodedResponseResult.fromJson(result);
}