httpEnableTimelineLogging method Null safety

Future<HttpTimelineLoggingState> httpEnableTimelineLogging(
  1. String isolateId,
  2. [bool? enabled]
)

The httpEnableTimelineLogging RPC is used to set and inspect the value of HttpClient.enableTimelineLogging, which determines if HTTP client requests should be logged to the timeline. If enabled is provided, the state of HttpClient.enableTimelineLogging will be updated to the value of enabled.

If the value of HttpClient.enableTimelineLogging is changed, a HttpTimelineLoggingStateChange event will be sent on the Extension stream.

Implementation

Future<HttpTimelineLoggingState> httpEnableTimelineLogging(String isolateId,
    [bool? enabled]) async {
  final version = await _version(isolateId);
  // Parameter name changed in version 1.4.
  final enableKey =
      ((version.major! == 1 && version.minor! > 3) || version.major! >= 2)
          ? 'enabled'
          : 'enable';
  return _callHelper('ext.dart.io.httpEnableTimelineLogging', isolateId,
      args: {
        if (enabled != null) enableKey: enabled,
      });
}