getLatestMetric method
Get the latest metric for a specific name
Implementation
PerformanceMetric? getLatestMetric(String name) {
final metrics = getMetricsByName(name);
if (metrics.isEmpty) return null;
metrics.sort((a, b) => b.timestamp.compareTo(a.timestamp));
return metrics.first;
}