Skip to content

Commit 711e3a9

Browse files
committed
refactor(router): simplify feedDecoratorService instantiation
- Remove redundant parameters from FeedDecoratorService - Add adService to HeadlinesFeedBloc
1 parent 28f5219 commit 711e3a9

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lib/router/router.dart

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'package:flutter_news_app_mobile_client_full_source_code/account/view/fol
1313
import 'package:flutter_news_app_mobile_client_full_source_code/account/view/followed_contents/topics/followed_topics_list_page.dart';
1414
import 'package:flutter_news_app_mobile_client_full_source_code/account/view/saved_filters_page.dart';
1515
import 'package:flutter_news_app_mobile_client_full_source_code/account/view/saved_headlines_page.dart';
16+
import 'package:flutter_news_app_mobile_client_full_source_code/ads/ad_service.dart';
1617
import 'package:flutter_news_app_mobile_client_full_source_code/ads/inline_ad_cache_service.dart';
1718
import 'package:flutter_news_app_mobile_client_full_source_code/ads/models/ad_theme_style.dart';
1819
import 'package:flutter_news_app_mobile_client_full_source_code/app/bloc/app_bloc.dart';
@@ -426,11 +427,7 @@ GoRouter createRouter({
426427
countryRepository: context
427428
.read<DataRepository<Country>>(),
428429
appBloc: context.read<AppBloc>(),
429-
feedDecoratorService: FeedDecoratorService(
430-
topicsRepository: context.read<DataRepository<Topic>>(),
431-
sourcesRepository: context
432-
.read<DataRepository<Source>>(),
433-
),
430+
feedDecoratorService: FeedDecoratorService(),
434431
inlineAdCacheService: context
435432
.read<InlineAdCacheService>(),
436433
)..add(
@@ -519,11 +516,8 @@ GoRouter createRouter({
519516
return HeadlinesFeedBloc(
520517
headlinesRepository: context
521518
.read<DataRepository<Headline>>(),
522-
feedDecoratorService: FeedDecoratorService(
523-
topicsRepository: context.read<DataRepository<Topic>>(),
524-
sourcesRepository: context
525-
.read<DataRepository<Source>>(),
526-
),
519+
feedDecoratorService: FeedDecoratorService(),
520+
adService: context.read<AdService>(),
527521
appBloc: appBloc,
528522
inlineAdCacheService: context
529523
.read<InlineAdCacheService>(),

0 commit comments

Comments
 (0)