filterHistory method Null safety
- List<
Destination> destinations
Filters the list of destinations to only contain the destination supported by the collection of page builders.
Implementation
@visibleForTesting
List<Destination> filterHistory(final List<Destination> destinations) {
final List<Destination> filteredHistory = <Destination>[];
for (final Destination destination in destinations) {
final bool supportedDestination = any(
(DBPageBuilder pageBuilder) => pageBuilder.supportRoute(destination),
);
if (kDebugMode) {
debugPrintThrottled(
'Did not found a page builder that can build ${destination.path}',
);
}
if (supportedDestination) {
filteredHistory.add(destination);
}
}
return filteredHistory;
}