@@ -460,10 +460,10 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
460460 Emitter <HeadlinesFeedState > emit,
461461 ) async {
462462 String newActiveFilterId;
463-
463+
464464 // Determine the active filter ID based on the applied criteria.
465465 // This logic is crucial for correctly highlighting the filter chip in the UI.
466-
466+
467467 // Case 1: A new filter was just saved ("Save & Apply").
468468 // The `savedHeadlineFilter` is passed explicitly to prevent a race condition
469469 // where the `state.savedHeadlineFilters` might not have updated yet.
@@ -484,15 +484,16 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
484484 // Case 2: A filter was applied from the filter page ("Apply Only") or
485485 // by applying an un-pinned saved filter.
486486 // We check if the criteria match any *pinned* saved filter.
487- final matchingPinnedFilter =
488- state.savedHeadlineFilters.firstWhereOrNull ((savedFilter) {
487+ final matchingPinnedFilter = state.savedHeadlineFilters.firstWhereOrNull ((
488+ savedFilter,
489+ ) {
489490 // Only consider pinned filters for direct ID matching.
490491 if (! savedFilter.isPinned) return false ;
491-
492+
492493 // Compare the criteria of the applied filter with the saved one.
493494 return savedFilter.criteria == event.filter;
494495 });
495-
496+
496497 if (matchingPinnedFilter != null ) {
497498 // If it matches a pinned filter, use its ID.
498499 newActiveFilterId = matchingPinnedFilter.id;
@@ -503,7 +504,7 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
503504 _logger.fine ('Applied filter is a one-time "custom" filter.' );
504505 }
505506 }
506-
507+
507508 final filterKey = _generateFilterKey (newActiveFilterId, event.filter);
508509 final cachedFeed = _feedCacheService.getFeed (filterKey);
509510
@@ -732,7 +733,7 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
732733 ) async {
733734 final filterKey = event.filter.id;
734735 final newFilter = event.filter.criteria;
735-
736+
736737 // If the selected filter is pinned, we can attempt a cache hit and set
737738 // its ID as the active one directly.
738739 if (event.filter.isPinned) {
@@ -759,15 +760,20 @@ class HeadlinesFeedBloc extends Bloc<HeadlinesFeedEvent, HeadlinesFeedState> {
759760 return ;
760761 }
761762 }
762-
763+
763764 // For un-pinned filters, or a cache miss on a pinned filter, delegate
764765 // to the standard `HeadlinesFeedFiltersApplied` handler. This ensures
765766 // consistent logic for loading and setting the active filter state
766767 // (which will be 'custom' for un-pinned filters).
767768 _logger.info (
768769 'Saved Filter Selected: Delegating to filter application for key "$filterKey ".' ,
769770 );
770- add (HeadlinesFeedFiltersApplied (filter: newFilter, adThemeStyle: event.adThemeStyle));
771+ add (
772+ HeadlinesFeedFiltersApplied (
773+ filter: newFilter,
774+ adThemeStyle: event.adThemeStyle,
775+ ),
776+ );
771777 }
772778
773779 Future <void > _onAllFilterSelected (
0 commit comments