filter method
Filters the list of all options based on a query - the list of current selections is also provided.
Implementation
@override
Future<List<SmartDateQueryResult>> filter(
String? query, List currentSelections, int limit) async {
if (query.isNullOrBlank) {
final location = sunnyLocalization.userLocation;
final defaultResults = [
/// Then, process the expressions
for (final expression
in config.defaultDates.whereType<DateExpression>())
SmartDateQueryResult.ofDateTime(expression.dateProducer(location!),
icon: expression.iconName, overrideLabel: expression.title)
.withDateRef(expression),
// /// First, process all the MetaDates
// for (final metaDate in config.defaultDates.whereType<MetaDateRef>())
// for (final factDate in await _smartDateService.resolveMetaDateResults(
// refs: [metaDate],
//// contact: config.contact,
//// facts: config.facts,
// location: location))
// factDate.withDateRef(metaDate),
/// Lastly, the query expressions
for (final query in config.defaultDates.whereType<SimpleDateQuery>())
for (final queryResult in await _filter(query.query, [], limit))
queryResult.withDateRef(query),
];
return defaultResults;
} else {
return await _filter(query!, currentSelections, limit);
}
}