All DTOs with factory methods that use localized placeholder text accept an S strings parameter, enabling reactive locale switching.
DTOs use gStrings in factory methods:
factory UserProfileDto.loading() => UserProfileDto(name: gStrings.loading);
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)
{required S strings} as named parametercontext.stringsgStrings usages remain in any DTO fileS stringsflutter analyze passeslib/auth/dtos/user_profile_dto.dart (8 usages)lib/cleaning/dtos/current_week_dto.dart (5 usages)lib/households/models/household_invite_model.dart (2 usages)lib/shopping/dtos/shopping_list_dto.dart (4 usages)lib/shopping/dtos/shopping_list_item_dto.dart (3 usages)flutter analyzeSome DTOs may have multiple factory methods that use localized text. Each factory method needs the S strings parameter added.
Reacties