Turn on avoid_dynamic_calls lint, except packages/flutter tests, make appropriate changes. (#84476)
This adds avoid_dynamic_calls to the list of lints, and fixes all instances where it was violated. Importantly, this lint is NOT turned on for flutter/packages/test, because those changes are happening in another PR: #84478
This commit is contained in:
@@ -595,7 +595,7 @@ class ArchivePublisher {
|
||||
if (!jsonData.containsKey('current_release')) {
|
||||
jsonData['current_release'] = <String, String>{};
|
||||
}
|
||||
jsonData['current_release'][branchName] = revision;
|
||||
(jsonData['current_release'] as Map<String, dynamic>)[branchName] = revision;
|
||||
if (!jsonData.containsKey('releases')) {
|
||||
jsonData['releases'] = <Map<String, dynamic>>[];
|
||||
}
|
||||
|
||||
@@ -1059,7 +1059,7 @@ Future<void> _ensureChromeDriverIsRunning() async {
|
||||
final HttpClientResponse response = await request.close();
|
||||
final Map<String, dynamic> webDriverStatus = json.decode(await response.transform(utf8.decoder).join('')) as Map<String, dynamic>;
|
||||
client.close();
|
||||
final bool webDriverReady = webDriverStatus['value']['ready'] as bool;
|
||||
final bool webDriverReady = (webDriverStatus['value'] as Map<String, dynamic>)['ready'] as bool;
|
||||
if (!webDriverReady) {
|
||||
throw Exception('WebDriver not available.');
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ void main() {
|
||||
// Make sure the new entry is first (and hopefully it takes less than a
|
||||
// minute to go from publishArchive above to this line!).
|
||||
expect(
|
||||
DateTime.now().difference(DateTime.parse(releases[0]['release_date'] as String)),
|
||||
DateTime.now().difference(DateTime.parse((releases[0] as Map<String, dynamic>)['release_date'] as String)),
|
||||
lessThan(const Duration(minutes: 1)),
|
||||
);
|
||||
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
|
||||
|
||||
@@ -255,7 +255,7 @@ class ArchiveUnpublisher {
|
||||
});
|
||||
jsonData['releases'] = releases;
|
||||
for (final Channel channel in channels) {
|
||||
if (!revisionsBeingRemoved.contains(jsonData['current_release'][getChannelName(channel)])) {
|
||||
if (!revisionsBeingRemoved.contains((jsonData['current_release'] as Map<String, dynamic>)[getChannelName(channel)])) {
|
||||
// Don't replace the current release if it's not one of the revisions we're removing.
|
||||
continue;
|
||||
}
|
||||
@@ -263,7 +263,7 @@ class ArchiveUnpublisher {
|
||||
if (replacementRelease == null) {
|
||||
throw UnpublishException('Unable to find previous release for channel ${getChannelName(channel)}.');
|
||||
}
|
||||
jsonData['current_release'][getChannelName(channel)] = replacementRelease['hash'];
|
||||
(jsonData['current_release'] as Map<String, dynamic>)[getChannelName(channel)] = replacementRelease['hash'];
|
||||
print(
|
||||
'${confirmed ? 'Reverting' : 'Would revert'} current ${getChannelName(channel)} '
|
||||
'${getPublishedPlatform(platform)} release to ${replacementRelease['hash']} (version ${replacementRelease['version']}).'
|
||||
|
||||
Reference in New Issue
Block a user