endTrace static method
Implementation
static Future<String?> endTrace(String traceKey, Map<String, int>? customMetric) async {
if (!_instance._countlyState.isInitialized) {
String message = '"initWithConfig" must be called before "endTrace"';
log('endTrace, $message', logLevel: LogLevel.ERROR);
return message;
}
int metricCount = customMetric != null ? customMetric.length : 0;
log('Calling "endTrace":[$traceKey] with metric count:[$metricCount]');
List<String> args = [];
args.add(traceKey);
if (customMetric != null) {
customMetric.forEach((k, v) {
args.add(k.toString());
args.add(v.toString());
});
}
final String? result = await _channel.invokeMethod('endTrace', <String, dynamic>{'data': json.encode(args)});
return result;
}