toString method

  1. @override
String toString()
override

For print formatting.

Implementation

@override
String toString() {
  final textAndScore = 'text: $text, score: ${score.toStringAsFixed(2)}';
  if (value != null) {
    return '$textAndScore, value: $value';
  } else {
    return textAndScore;
  }
}