Skip to content

Commit baa77f1

Browse files
author
shaark
committed
issue-124. exclude copyWith from nubmer of parameters
1 parent b631295 commit baa77f1

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

lint_test/analysis_options.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ custom_lint:
1515
exclude:
1616
- method_name: avoidNumberOfParameters
1717
class_name: Exclude
18-
- method_name: avoidNumberOfParameters
18+
- method_name: avoidNumberOfParameters
19+
- method_name: copyWith
20+
class_name: UserDto
1921
- function_lines_of_code:
2022
max_lines: 50
2123
- avoid_non_null_assertion

lint_test/number_of_parameters_test.dart

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,39 @@ class Exclude {
1818
return a + b + c;
1919
}
2020
}
21+
22+
class UserDto {
23+
final String email;
24+
final String firstName;
25+
final String id;
26+
final String imageUrl;
27+
final String lastName;
28+
29+
final String phone;
30+
const UserDto({
31+
required this.id,
32+
required this.firstName,
33+
required this.lastName,
34+
required this.imageUrl,
35+
required this.email,
36+
required this.phone,
37+
});
38+
39+
UserDto copyWith({
40+
String? email,
41+
String? firstName,
42+
String? id,
43+
String? imageUrl,
44+
String? lastName,
45+
String? phone,
46+
}) {
47+
return UserDto(
48+
email: email ?? this.email,
49+
firstName: firstName ?? this.firstName,
50+
id: id ?? this.id,
51+
imageUrl: imageUrl ?? this.imageUrl,
52+
lastName: lastName ?? this.lastName,
53+
phone: phone ?? this.phone,
54+
);
55+
}
56+
}

0 commit comments

Comments
 (0)