keyLog property

  1. @override
set keyLog (dynamic callback(String line)?)
override

Sets a callback that will be called when new TLS keys are exchanged with the server. It will receive one line of text in NSS Key Log Format for each call. Writing these lines to a file will allow tools (such as Wireshark) to decrypt communication between the this client and the server. This is meant to allow network-level debugging of secure sockets and should not be used in production code. For example:

final log = File('keylog.txt');
final client = HttpClient();
client.keyLog = (line) => log.writeAsStringSync(line,
    mode: FileMode.append);

Implementation

@override
set keyLog(Function(String line)? callback) {
  client.keyLog = callback;
}