emulateNetworkConditions method
Activates emulation of network conditions.
offline
True to emulate internet disconnection.
latency
Minimum latency from request sent to response headers received (ms).
downloadThroughput
Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
uploadThroughput
Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling.
connectionType
Connection type if known.
packetLoss
WebRTC packet loss (percent, 0-100). 0 disables packet loss emulation, 100 drops all the packets.
packetQueueLength
WebRTC packet queue length (packet). 0 removes any queue length limitations.
packetReordering
WebRTC packetReordering feature.
Implementation
Future<void> emulateNetworkConditions(
bool offline,
num latency,
num downloadThroughput,
num uploadThroughput, {
ConnectionType? connectionType,
num? packetLoss,
int? packetQueueLength,
bool? packetReordering,
}) async {
await _client.send('Network.emulateNetworkConditions', {
'offline': offline,
'latency': latency,
'downloadThroughput': downloadThroughput,
'uploadThroughput': uploadThroughput,
if (connectionType != null) 'connectionType': connectionType,
if (packetLoss != null) 'packetLoss': packetLoss,
if (packetQueueLength != null) 'packetQueueLength': packetQueueLength,
if (packetReordering != null) 'packetReordering': packetReordering,
});
}