recordNetworkTrace static method

Future<String?> recordNetworkTrace(
  1. String networkTraceKey,
  2. int responseCode,
  3. int requestPayloadSize,
  4. int responsePayloadSize,
  5. int startTime,
  6. int endTime,
)

Implementation

static Future<String?> recordNetworkTrace(String networkTraceKey, int responseCode, int requestPayloadSize, int responsePayloadSize, int startTime, int endTime) async {
  if (!_instance._countlyState.isInitialized) {
    String message = '"initWithConfig" must be called before "recordNetworkTrace"';
    log('recordNetworkTrace, $message', logLevel: LogLevel.ERROR);
    return message;
  }
  log('Calling "recordNetworkTrace":[$networkTraceKey] with response Code:[$responseCode]');
  List<String> args = [];
  args.add(networkTraceKey);
  args.add(responseCode.toString());
  args.add(requestPayloadSize.toString());
  args.add(responsePayloadSize.toString());
  args.add(startTime.toString());
  args.add(endTime.toString());

  final String? result = await _channel.invokeMethod('recordNetworkTrace', <String, dynamic>{'data': json.encode(args)});

  return result;
}