High-priority fixes (10 issues): - assignment_to_final errors (7): Use copyWith() to respect immutability in YourLocation, active_fires.dart, generic_map.dart, location_utils.dart, and fetch_data_middleware.dart instead of direct assignment - Fixed import paths (3): Updated falsePositiveTypes.dart → false_positive_types.dart and firesApi.dart → fires_api.dart in reducers.dart, fire_notification_actions.dart, fires_api.dart Medium/Low priority fixes (3 issues): - unnecessary_non_null_assertion: Removed redundant '!' in app_intro_page.dart line 54 - use_super_parameters: Updated app_intro_page.dart to use modern super(key: key) syntax - no_logic_in_create_state: Fixed material_app_with_intro.dart by moving parameters to State instead of createState - noop_primitive_operations: Removed redundant .toString() in string interpolation - avoid_void_async: Changed void _selectLocation to Future<void> in places_autocomplete_utils.dart - avoid_dynamic_calls: Fixed dynamic map access in fires_api.dart by properly casting intermediate values Result: Reduced lint issues from 56 to 20 (all remaining are by-design: library_private_types_in_public_api and implementation_imports from external packages) APK builds successfully with no errors.
52 lines
1.9 KiB
Dart
52 lines
1.9 KiB
Dart
import 'package:redux/redux.dart';
|
|
|
|
import '../models/fire_notification.dart';
|
|
import 'actions.dart';
|
|
|
|
final Reducer<List<FireNotification>> fireNotificationReducer =
|
|
combineReducers<List<FireNotification>>(<Reducer<List<FireNotification>>>[
|
|
TypedReducer<List<FireNotification>, AddedFireNotificationAction>(
|
|
_addedFireNotification),
|
|
TypedReducer<List<FireNotification>, DeletedFireNotificationAction>(
|
|
_deletedFireNotification),
|
|
TypedReducer<List<FireNotification>, UpdatedFireNotificationAction>(
|
|
_updatedFireNotification),
|
|
TypedReducer<List<FireNotification>, DeletedAllFireNotificationAction>(
|
|
_deletedAllFireNotifications),
|
|
TypedReducer<List<FireNotification>, ReadedFireNotificationAction>(
|
|
_readedFireNotification)
|
|
]);
|
|
|
|
List<FireNotification> _addedFireNotification(
|
|
List<FireNotification> notifications, AddedFireNotificationAction action) {
|
|
return List<FireNotification>.from(notifications)..insert(0, action.notif);
|
|
}
|
|
|
|
List<FireNotification> _deletedFireNotification(
|
|
List<FireNotification> notifications,
|
|
DeletedFireNotificationAction action) {
|
|
return List<FireNotification>.from(notifications)..remove(action.notif);
|
|
}
|
|
|
|
List<FireNotification> _updatedFireNotification(
|
|
List<FireNotification> notifications,
|
|
UpdatedFireNotificationAction action) {
|
|
return notifications
|
|
.map((FireNotification notif) =>
|
|
notif.id == action.notif.id ? action.notif : notif)
|
|
.toList();
|
|
}
|
|
|
|
List<FireNotification> _readedFireNotification(
|
|
List<FireNotification> notifications, ReadedFireNotificationAction action) {
|
|
return notifications
|
|
.map((FireNotification yourLocation) =>
|
|
yourLocation.id == action.notif.id ? action.notif : yourLocation)
|
|
.toList();
|
|
}
|
|
|
|
List<FireNotification> _deletedAllFireNotifications(
|
|
List<FireNotification> notifications,
|
|
DeletedAllFireNotificationAction action) {
|
|
return <FireNotification>[];
|
|
}
|