-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(lints): unnecessary_string_escapes and prefer_function_declarations_over_variables rules #160
Conversation
@manjotsidhu, Review this PR! |
@@ -42,6 +42,7 @@ void main() { | |||
await _pumpForgotPasswordView(tester); | |||
await tester.pumpAndSettle(); | |||
|
|||
// ignore: prefer_function_declarations_over_variables | |||
var _forgotPasswordImagePredicate = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignoring the rule might not be the best thing to do here. The rule says if you want to make functions then prefer proper declarations instead of creating variables. More info: https://dart-lang.github.io/linter/lints/prefer_function_declarations_over_variables.html
In our case we can simply avoid creating the variable for function since we just have 1 usage of that variable and instead we will simply use the function implementation where we need it.
Example,
From :
var _forgotPasswordImagePredicate =
(Widget widget) => widget is Image && widget.height == 300;
expect(find.byWidgetPredicate(_forgotPasswordImagePredicate),
findsOneWidget);
To:
expect(find.byWidgetPredicate((Widget widget) => widget is Image && widget.height == 300),
findsOneWidget);
(needs formatting)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay,I Will do that.
Thank you!
Pull Request Test Coverage Report for Build 1342827371
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Refer #149
Fix lint rules: