enable lint prefer_final_in_for_each (#47724)

This commit is contained in:
Alexandre Ardhuin
2020-01-07 16:32:04 +01:00
committed by GitHub
parent fa337f5922
commit 4f9b6cf017
369 changed files with 1219 additions and 1220 deletions

View File

@@ -149,7 +149,7 @@ class AndroidSemanticsNode {
/// Gets a list of [AndroidSemanticsActions] which are defined for the node.
List<AndroidSemanticsAction> getActions() => <AndroidSemanticsAction>[
for (int id in (_values['actions'] as List<dynamic>).cast<int>()) AndroidSemanticsAction.deserialize(id),
for (final int id in (_values['actions'] as List<dynamic>).cast<int>()) AndroidSemanticsAction.deserialize(id),
];
@override

View File

@@ -399,7 +399,7 @@ void main() {
// catch up.
await Future<void>.delayed(const Duration(milliseconds: 1500));
for (String item in popupItems) {
for (final String item in popupItems) {
expect(
await getSemantics(find.byValueKey('$popupKeyValue.$item')),
hasAndroidSemantics(
@@ -423,7 +423,7 @@ void main() {
await driver.tap(find.byValueKey(popupButtonKeyValue));
await Future<void>.delayed(const Duration(milliseconds: 1500));
for (String item in popupItems) {
for (final String item in popupItems) {
expect(
await getSemantics(find.byValueKey('$popupKeyValue.$item')),
hasAndroidSemantics(
@@ -467,7 +467,7 @@ void main() {
try {
await Future<void>.delayed(const Duration(milliseconds: 1500));
for (String item in popupItems) {
for (final String item in popupItems) {
// There are two copies of each item, so we want to find the version
// that is in the overlay, not the one in the dropdown.
expect(
@@ -503,7 +503,7 @@ void main() {
await driver.tap(find.byValueKey(dropdownButtonKeyValue));
await Future<void>.delayed(const Duration(milliseconds: 1500));
for (String item in popupItems) {
for (final String item in popupItems) {
// There are two copies of each item, so we want to find the version
// that is in the overlay, not the one in the dropdown.
expect(
@@ -572,7 +572,7 @@ void main() {
),
reason: "Alert OK button doesn't have the right semantics");
for (String item in <String>['Title', 'Body1', 'Body2']) {
for (final String item in <String>['Title', 'Body1', 'Body2']) {
expect(
await getSemantics(find.byValueKey('$alertKeyValue.$item')),
hasAndroidSemantics(
@@ -611,7 +611,7 @@ void main() {
),
reason: "Alert OK button doesn't have the right semantics");
for (String item in <String>['Title', 'Body1', 'Body2']) {
for (final String item in <String>['Title', 'Body1', 'Body2']) {
expect(
await getSemantics(find.byValueKey('$alertKeyValue.$item')),
hasAndroidSemantics(

View File

@@ -122,7 +122,7 @@ void diffMaps(
'${messagePrefix}keys (expected: ${expected.keys} actual: ${actual.keys} ');
return;
}
for (String key in expected.keys) {
for (final String key in expected.keys) {
if (excludeKeys.contains(key))
continue;
if (doublesApproximatelyMatch(expected[key], actual[key]))

View File

@@ -123,7 +123,7 @@ class MotionEventsBodyState extends State<MotionEventsBody> {
await channel.invokeMethod<void>('pipeFlutterViewEvents');
await viewChannel.invokeMethod<void>('pipeTouchEvents');
print('replaying ${recordedEvents.length} motion events');
for (Map<String, dynamic> event in recordedEvents.reversed) {
for (final Map<String, dynamic> event in recordedEvents.reversed) {
await channel.invokeMethod<void>('synthesizeEvent', event);
}

View File

@@ -174,7 +174,7 @@ bool _deepEqualsList(List<dynamic> a, List<dynamic> b) {
bool _deepEqualsMap(Map<dynamic, dynamic> a, Map<dynamic, dynamic> b) {
if (a.length != b.length)
return false;
for (dynamic key in a.keys) {
for (final dynamic key in a.keys) {
if (!b.containsKey(key) || !_deepEquals(a[key], b[key]))
return false;
}