getSuggestions method
- String input
override
Implementation
@override
Future<List<String>> getSuggestions(
final String input,
) async {
_inputs.add(input);
final List<String>? cached = _cache[input];
if (cached != null) {
return cached;
}
await waitForTestPurpose();
_cache[input] = await autocompleter.getSuggestions(input);
// meanwhile there might have been some calls to this method, adding inputs.
for (final String latestInput in _inputs.reversed) {
final List<String>? cached = _cache[latestInput];
if (cached != null) {
return cached;
}
}
// not supposed to happen, as we should have downloaded for "input".
return <String>[];
}