refactor: Moves DTO list creation to extension

Moves the `fromList` method from a factory constructor within the DTO class to an instance method within an extension. This refactors the way DTOs are instantiated from lists, promoting better organization of related utility logic outside the main class definition.
This commit is contained in:
your-name 2025-07-31 01:29:59 +03:00
parent 61252a3aa9
commit 288b57d4cf

View File

@ -22,9 +22,11 @@ abstract class UpdateMoveLineDto with _$UpdateMoveLineDto {
factory UpdateMoveLineDto.fromJson(Map<String, dynamic> json) =>
_$UpdateMoveLineDtoFromJson(json);
}
extension UpdateMoveLineDtoExt on UpdateMoveLineDto {
/// Constructeur depuis List
factory UpdateMoveLineDto.fromList(List<dynamic> list) {
UpdateMoveLineDto fromList(List<dynamic> list) {
if (list.length != 3) {
throw ArgumentError('La liste doit contenir exactement 3 éléments');
}