add method
Add entryValue
to the set of possible suggestions.
Optionally update Entry.subScore at same time.
If entryValue
cannot be mapped to at least 1 key via specified TermMapping
then it is not added and return value is false.
If entryValue
is successfully added or already exists then return value is true.
Implementation
bool add(String entryValue, {int? subScore}) {
final entry = _entries[entryValue];
if (identical(entry, null)) {
return _addEntry(Entry._(entryValue, secondaryValue: subScore));
}
// we already know this suggestion so just update its secondary value
if (!identical(subScore, null)) {
entry._subScore = subScore;
}
return true;
}