Skip to content

Commit 53e8a32

Browse files
committed
fix(deps): resolve linter warnings and compile errors
Corrects several issues in `app_dependencies.dart`: - Adds missing documentation comments for all public repository and service members. - Refactors simple `toJson` handlers to use cascade notation to resolve linter warnings. - Injects the `Logger` into `InMemoryTokenBlacklistService` to fix a compile error.
1 parent c98bc5f commit 53e8a32

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

lib/src/config/app_dependencies.dart

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,40 @@ class AppDependencies {
3838
final _completer = Completer<void>();
3939

4040
// --- Repositories ---
41+
/// A repository for managing [Headline] data.
4142
late final HtDataRepository<Headline> headlineRepository;
43+
/// A repository for managing [Topic] data.
4244
late final HtDataRepository<Topic> topicRepository;
45+
/// A repository for managing [Source] data.
4346
late final HtDataRepository<Source> sourceRepository;
47+
/// A repository for managing [Country] data.
4448
late final HtDataRepository<Country> countryRepository;
49+
/// A repository for managing [User] data.
4550
late final HtDataRepository<User> userRepository;
51+
/// A repository for managing [UserAppSettings] data.
4652
late final HtDataRepository<UserAppSettings> userAppSettingsRepository;
53+
/// A repository for managing [UserContentPreferences] data.
4754
late final HtDataRepository<UserContentPreferences>
4855
userContentPreferencesRepository;
56+
/// A repository for managing the global [RemoteConfig] data.
4957
late final HtDataRepository<RemoteConfig> remoteConfigRepository;
5058

5159
// --- Services ---
60+
/// A service for sending emails.
5261
late final HtEmailRepository emailRepository;
62+
/// A service for managing a blacklist of invalidated authentication tokens.
5363
late final TokenBlacklistService tokenBlacklistService;
64+
/// A service for generating and validating authentication tokens.
5465
late final AuthTokenService authTokenService;
66+
/// A service for storing and validating one-time verification codes.
5567
late final VerificationCodeStorageService verificationCodeStorageService;
68+
/// A service that orchestrates authentication logic.
5669
late final AuthService authService;
70+
/// A service for calculating and providing a summary for the dashboard.
5771
late final DashboardSummaryService dashboardSummaryService;
72+
/// A service for checking user permissions.
5873
late final PermissionService permissionService;
74+
/// A service for enforcing limits on user content preferences.
5975
late final UserPreferenceLimitService userPreferenceLimitService;
6076

6177
/// Initializes all application dependencies.
@@ -104,18 +120,13 @@ class AppDependencies {
104120
// columns. The Headline.fromJson factory expects ISO 8601 strings.
105121
// This handler converts them before deserialization.
106122
(json) => Headline.fromJson(_convertTimestampsToString(json)),
107-
(headline) {
108-
final json = headline.toJson();
109-
// The database expects foreign key IDs, not nested objects.
110-
// We extract the IDs and remove the original objects.
111-
json['source_id'] = headline.source.id;
112-
json['topic_id'] = headline.topic.id;
113-
json['event_country_id'] = headline.eventCountry.id;
114-
json.remove('source');
115-
json.remove('topic');
116-
json.remove('eventCountry');
117-
return json;
118-
},
123+
(headline) => headline.toJson()
124+
..['source_id'] = headline.source.id
125+
..['topic_id'] = headline.topic.id
126+
..['event_country_id'] = headline.eventCountry.id
127+
..remove('source')
128+
..remove('topic')
129+
..remove('eventCountry'),
119130
);
120131
topicRepository = _createRepository(
121132
connection,
@@ -127,13 +138,9 @@ class AppDependencies {
127138
connection,
128139
'sources',
129140
(json) => Source.fromJson(_convertTimestampsToString(json)),
130-
(source) {
131-
final json = source.toJson();
132-
// The database expects headquarters_country_id, not a nested object.
133-
json['headquarters_country_id'] = source.headquarters.id;
134-
json.remove('headquarters');
135-
return json;
136-
},
141+
(source) => source.toJson()
142+
..['headquarters_country_id'] = source.headquarters.id
143+
..remove('headquarters'),
137144
);
138145
countryRepository = _createRepository(
139146
connection,
@@ -158,7 +165,7 @@ class AppDependencies {
158165
userAppSettingsRepository = _createRepository(
159166
connection,
160167
'user_app_settings',
161-
UserAppSettings.fromJson,
168+
(json) => UserAppSettings.fromJson(json),
162169
(settings) {
163170
final json = settings.toJson();
164171
// These fields are complex objects and must be JSON encoded for the DB.
@@ -170,7 +177,7 @@ class AppDependencies {
170177
userContentPreferencesRepository = _createRepository(
171178
connection,
172179
'user_content_preferences',
173-
UserContentPreferences.fromJson,
180+
(json) => UserContentPreferences.fromJson(json),
174181
(preferences) {
175182
final json = preferences.toJson();
176183
// These fields are lists of complex objects and must be JSON encoded.

0 commit comments

Comments
 (0)