-
Notifications
You must be signed in to change notification settings - Fork 119
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
Remove all dynamic calls and properly enforce lint rule #2582
Changes from all commits
e2fd325
f3b3727
a4ced05
91a8abb
71dcffc
ab3350e
641f36b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1097,7 +1097,7 @@ abstract class ModelElement extends Canonicalization | |
} | ||
if (params == null && element is FunctionTypedElement) { | ||
if (_originalMember != null) { | ||
params = (_originalMember as dynamic).parameters; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a good one to get rid of. That might cover up some nasty bugs otherwise. Don't remember why that is there... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haha it was a little weird. |
||
params = (_originalMember as FunctionTypedElement).parameters; | ||
} else { | ||
params = (element as FunctionTypedElement).parameters; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,17 +124,20 @@ Future<List<String>> _packageUrls(int page) { | |
return http | ||
.get(Uri.parse('https://pub.dartlang.org/packages.json?page=$page')) | ||
.then((response) { | ||
return List<String>.from(json.decode(response.body)['packages']); | ||
var decodedJson = json.decode(response.body) as Map; | ||
return (decodedJson['packages'] as List).cast<String>(); | ||
}); | ||
} | ||
|
||
Future<List<PackageInfo>> _getPackageInfos(List<String> packageUrls) { | ||
var futures = packageUrls.map((String p) { | ||
return http.get(Uri.parse(p)).then((response) { | ||
var decodedJson = json.decode(response.body); | ||
var decodedJson = json.decode(response.body) as Map; | ||
String name = decodedJson['name']; | ||
var versions = List<Version>.from( | ||
decodedJson['versions'].map((v) => Version.parse(v))); | ||
var versions = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assuming inference works properly for the list type here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, |
||
for (var version in decodedJson['versions'] as List) | ||
Version.parse(version as String), | ||
]; | ||
return PackageInfo(name, Version.primary(versions)); | ||
}); | ||
}).toList(); | ||
|
@@ -216,8 +219,8 @@ Future<void> _exec(String command, List<String> args, | |
}); | ||
} | ||
|
||
bool _isOldSdkConstraint(var pubspecInfo) { | ||
var environment = pubspecInfo['environment']; | ||
bool _isOldSdkConstraint(Map<String, dynamic> pubspecInfo) { | ||
srawlins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var environment = pubspecInfo['environment'] as Map; | ||
if (environment != null) { | ||
var sdk = environment['sdk']; | ||
if (sdk != null) { | ||
|
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.
I think this is fine, though it seems odd to me to omit
<String>
?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.
String
is inferred from the elements as the type of the list. This is listed in Effective Dart:https://dart.dev/guides/language/effective-dart/design#dont-write-type-arguments-on-generic-invocations-that-are-inferred