From 288b57d4cf5def1b6b81b4691d06d48a2814dc92 Mon Sep 17 00:00:00 2001 From: your-name Date: Thu, 31 Jul 2025 01:29:59 +0300 Subject: [PATCH] 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. --- lib/backend/schema/stock_picking/update_move_line_dto.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/backend/schema/stock_picking/update_move_line_dto.dart b/lib/backend/schema/stock_picking/update_move_line_dto.dart index ea5b6c3..34747ae 100644 --- a/lib/backend/schema/stock_picking/update_move_line_dto.dart +++ b/lib/backend/schema/stock_picking/update_move_line_dto.dart @@ -22,9 +22,11 @@ abstract class UpdateMoveLineDto with _$UpdateMoveLineDto { factory UpdateMoveLineDto.fromJson(Map json) => _$UpdateMoveLineDtoFromJson(json); +} +extension UpdateMoveLineDtoExt on UpdateMoveLineDto { /// Constructeur depuis List - factory UpdateMoveLineDto.fromList(List list) { + UpdateMoveLineDto fromList(List list) { if (list.length != 3) { throw ArgumentError('La liste doit contenir exactement 3 éléments'); }