Athena — roomy-mobile/archive/changes/2025-12-28-fix-runtime-locale-switching/tasks/004-migrate-dtos.md


status: done

Task: Migrate DTO factory methods to accept S parameter

End Goal

All DTOs with factory methods that use localized placeholder text accept an S strings parameter, enabling reactive locale switching.

Currently

DTOs use gStrings in factory methods:

factory UserProfileDto.loading() => UserProfileDto(name: gStrings.loading);

Should

DTOs accept an S strings parameter:

factory UserProfileDto.loading({required S strings}) => UserProfileDto(name: strings.loading);

Call sites provide context.strings:

UserProfileDto.loading(strings: context.strings)

Constraints

  • [ ] Use {required S strings} as named parameter
  • [ ] Update all call sites to pass context.strings
  • [ ] Maintain existing factory method names

Acceptance Criteria

  • [ ] No gStrings usages remain in any DTO file
  • [ ] All DTO factory methods with localized text accept S strings
  • [ ] All call sites compile without errors
  • [ ] flutter analyze passes

Implementation Checklist

  • [x] 4.1 Migrate lib/auth/dtos/user_profile_dto.dart (8 usages)
  • [x] 4.2 Migrate lib/cleaning/dtos/current_week_dto.dart (5 usages)
  • [x] 4.3 Migrate lib/households/models/household_invite_model.dart (2 usages)
  • [x] 4.4 Migrate lib/shopping/dtos/shopping_list_dto.dart (4 usages)
  • [x] 4.5 Migrate lib/shopping/dtos/shopping_list_item_dto.dart (3 usages)
  • [x] 4.6 Update all call sites for each migrated DTO
  • [x] 4.7 Run flutter analyze

Notes

Some DTOs may have multiple factory methods that use localized text. Each factory method needs the S strings parameter added.

Reacties

Nog geen reacties