toString method
override
Returns a string representation of (some of) the elements of this
.
Elements are represented by their own toString
results.
The default representation always contains the first three elements. If there are less than a hundred elements in the iterable, it also contains the last two elements.
If the resulting string isn't above 80 characters, more elements are included from the start of the iterable.
The conversion may omit calling toString
on some elements if they
are known to not occur in the output, and it may stop iterating after
a hundred elements.
Implementation
@override
String toString() {
final List<CandidateType> valuesList = _values.toList();
// This will put each value on its own line with a comma and indentation
final String valuesString = valuesList.fold(
'',
(String current, CandidateType candidate) => '$current\n $candidate,',
);
return 'Found ${valuesList.length} ${_describeMatch(Plurality._fromNum(valuesList.length))}: ['
'${valuesString.isNotEmpty ? '$valuesString\n' : ''}'
']';
}