FinderResult<CandidateType> constructor

FinderResult<CandidateType>(
  1. DescribeMatchCallback describeMatch,
  2. Iterable<CandidateType> values
)

Creates a new FinderResult that describes the values using the given describeMatch callback.

The description returned should be a brief English phrase describing a matching candidate with the proper plural form. As an example for a string finder that is looking for strings starting with "hello":

String describeMatch(Plurality plurality) {
  return switch (plurality) {
    Plurality.zero || Plurality.many => 'strings starting with "hello"',
    Plurality.one => 'string starting with "hello"',
  };
}

Implementation

FinderResult(DescribeMatchCallback describeMatch, Iterable<CandidateType> values)
  : _describeMatch = describeMatch, _values = values;