recordNetworkTrace static method
record a network trace returns error or success message
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;
}