getValue<T extends EvaluationMetric> method

T getValue<T extends EvaluationMetric>(
  1. String metricName
)

Returns the metric named metricName cast to T.

Throws StateError if not found or wrong type.

Implementation

T getValue<T extends EvaluationMetric>(String metricName) {
  final m = metrics[metricName];
  if (m is T) return m;
  throw StateError(
      "Metric '$metricName' of type $T was not found in the result.");
}