-
Notifications
You must be signed in to change notification settings - Fork 175
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
Improve Flutter and Dart SDK using official lint rules #372
Improve Flutter and Dart SDK using official lint rules #372
Conversation
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.
Just a couple of things to consider. This looks good and will work fine, I just wanted to drop notes on some ideas going forward.
@@ -38,9 +38,9 @@ class {{ service.name | caseUcfirst }} extends Service { | |||
}; | |||
|
|||
{% if method.type == 'location' %} | |||
params.keys.forEach((key) {if (params[key] is int || params[key] is double) { | |||
for(var key in params.keys) {if (params[key] is int || params[key] is double) { |
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.
Why a for loop when you could use filter/map/reduce? (Map is faster and resource efficient).
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.
removed, as I think this was a leftover
@@ -40,15 +40,15 @@ class ClientMixin { | |||
} else if (method == HttpMethod.get) { | |||
final encoded = <String, dynamic>{}; | |||
if (params.isNotEmpty) { | |||
params.keys.forEach((key) { | |||
for(var key in params.keys) { |
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.
Why a for loop when you could use a map? (Map is faster and resource efficient).
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.
updated
params.keys.forEach((key) {if (params[key] is int || params[key] is double) { | ||
params[key] = params[key].toString(); | ||
}}); | ||
for (var key in params.keys) { |
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.
Suggest using a map/filter here
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.
removed, as I think this was a leftover
message.channels.forEach((channel) { | ||
if (this._channels[channel] != null) { | ||
this._channels[channel]!.forEach((stream) { | ||
for(var channel in message.channels) { |
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.
since dealing with sinks, for loop looks good here.
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
No description provided.