Skip to content

Commit 7b78c66

Browse files
committed
refactor(country): improve type safety in aggregation pipeline
- Change return type of _buildAggregationPipeline from List<Map<String, dynamic>> to List<Map<String, Object>> - Update pipeline variable type accordingly - Modify sortStage map type from dynamic to Object for better type safety
1 parent 0d8ac30 commit 7b78c66

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/src/services/country_query_service.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ class CountryQueryService {
115115
}
116116

117117
/// Builds the MongoDB aggregation pipeline based on the provided filters.
118-
List<Map<String, dynamic>> _buildAggregationPipeline(
118+
List<Map<String, Object>> _buildAggregationPipeline(
119119
Map<String, dynamic> filter,
120120
PaginationOptions? pagination,
121121
List<SortOption>? sort,
122122
) {
123-
final pipeline = <Map<String, dynamic>>[];
123+
final pipeline = <Map<String, Object>>[];
124124
final compoundMatchStages = <Map<String, dynamic>>[];
125125

126126
// --- Stage 1: Initial Match for active status, text search, and other filters ---
@@ -209,7 +209,7 @@ class CountryQueryService {
209209

210210
// --- Stage 4: Sorting ---
211211
if (sort != null && sort.isNotEmpty) {
212-
final sortStage = <String, dynamic>{};
212+
final sortStage = <String, Object>{};
213213
for (final option in sort) {
214214
sortStage[option.field] = option.order == SortOrder.asc ? 1 : -1;
215215
}

0 commit comments

Comments
 (0)