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:
parent
61252a3aa9
commit
288b57d4cf
@ -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');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user