Skip to content

Commit 6c59ccc

Browse files
committed
style: format misc
1 parent 384f2aa commit 6c59ccc

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

lib/src/registry/data_operation_registry.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ class DataOperationRegistry {
135135

136136
// If either 'usage' or 'name' filter is present, delegate to CountryService.
137137
// Sorting and pagination are handled by CountryService for these specialized queries.
138-
if ((usage != null && usage.isNotEmpty) || (name != null && name.isNotEmpty)) {
138+
if ((usage != null && usage.isNotEmpty) ||
139+
(name != null && name.isNotEmpty)) {
139140
final countryService = c.read<CountryService>();
140141
final countries = await countryService.getCountries(f);
141142
return PaginatedResponse<Country>(
@@ -147,11 +148,11 @@ class DataOperationRegistry {
147148
// For standard requests without specialized filters, use the repository
148149
// which supports pagination/sorting.
149150
return c.read<DataRepository<Country>>().readAll(
150-
userId: uid,
151-
filter: f,
152-
sort: s,
153-
pagination: p,
154-
);
151+
userId: uid,
152+
filter: f,
153+
sort: s,
154+
pagination: p,
155+
);
155156
}
156157
},
157158
'language': (c, uid, f, s, p) => c

lib/src/services/country_service.dart

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class CountryService {
4949

5050
// In-memory caches for frequently accessed lists with time-based invalidation.
5151
final Map<String, _CacheEntry<List<Country>>> _cachedEventCountries = {};
52-
final Map<String, _CacheEntry<List<Country>>> _cachedHeadquarterCountries = {};
52+
final Map<String, _CacheEntry<List<Country>>> _cachedHeadquarterCountries =
53+
{};
5354

5455
// Futures to hold in-flight aggregation requests to prevent cache stampedes.
5556
Future<List<Country>>? _eventCountriesFuture;
@@ -127,12 +128,14 @@ class CountryService {
127128
combinedFilter.addAll({'name': nameFilter});
128129
}
129130

130-
final response = await _countryRepository.readAll(
131-
filter: combinedFilter,
132-
);
131+
final response = await _countryRepository.readAll(filter: combinedFilter);
133132
return response.items;
134133
} catch (e, s) {
135-
_log.severe('Failed to fetch all countries with nameFilter: $nameFilter.', e, s);
134+
_log.severe(
135+
'Failed to fetch all countries with nameFilter: $nameFilter.',
136+
e,
137+
s,
138+
);
136139
throw OperationFailedException('Failed to retrieve all countries: $e');
137140
}
138141
}
@@ -155,8 +158,9 @@ class CountryService {
155158
}
156159
// Atomically assign the future if no fetch is in progress,
157160
// and clear it when the future completes.
158-
_eventCountriesFuture ??= _fetchAndCacheEventCountries(nameFilter: nameFilter)
159-
.whenComplete(() => _eventCountriesFuture = null);
161+
_eventCountriesFuture ??= _fetchAndCacheEventCountries(
162+
nameFilter: nameFilter,
163+
).whenComplete(() => _eventCountriesFuture = null);
160164
return _eventCountriesFuture!;
161165
}
162166

@@ -178,9 +182,9 @@ class CountryService {
178182
}
179183
// Atomically assign the future if no fetch is in progress,
180184
// and clear it when the future completes.
181-
_headquarterCountriesFuture ??=
182-
_fetchAndCacheHeadquarterCountries(nameFilter: nameFilter)
183-
.whenComplete(() => _headquarterCountriesFuture = null);
185+
_headquarterCountriesFuture ??= _fetchAndCacheHeadquarterCountries(
186+
nameFilter: nameFilter,
187+
).whenComplete(() => _headquarterCountriesFuture = null);
184188
return _headquarterCountriesFuture!;
185189
}
186190

@@ -287,11 +291,9 @@ class CountryService {
287291

288292
// Add name filter if provided
289293
if (nameFilter != null && nameFilter.isNotEmpty) {
290-
pipeline.add(
291-
<String, Object>{
292-
r'$match': <String, Object>{'$fieldName.name': nameFilter},
293-
},
294-
);
294+
pipeline.add(<String, Object>{
295+
r'$match': <String, Object>{'$fieldName.name': nameFilter},
296+
});
295297
}
296298

297299
pipeline.addAll([

0 commit comments

Comments
 (0)