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

@@ -51,7 +51,7 @@ class BenchmarkResultPrinter {
String _printJson() {
final Map<String, double> results = <String, double>{};
for (_BenchmarkResult result in _results) {
for (final _BenchmarkResult result in _results) {
results[result.name] = result.value;
}
return json.encode(results);
@@ -59,7 +59,7 @@ class BenchmarkResultPrinter {
String _printPlainText() {
final StringBuffer buf = StringBuffer();
for (_BenchmarkResult result in _results) {
for (final _BenchmarkResult result in _results) {
buf.writeln('${result.description}: ${result.value.toStringAsFixed(1)} ${result.unit}');
}
return buf.toString();

View File

@@ -16,7 +16,7 @@ void main() {
print('Velocity tracker benchmark...');
watch.start();
for (int i = 0; i < _kNumIters; i += 1) {
for (PointerEvent event in velocityEventData) {
for (final PointerEvent event in velocityEventData) {
if (event is PointerDownEvent || event is PointerMoveEvent)
tracker.addPosition(event.timeStamp, event.position);
if (event is PointerUpEvent)

View File

@@ -84,7 +84,7 @@ Iterable<int> generateIterableList() {
int sumIterable(Iterable<int> values) {
int result = 0;
for (int value in values) {
for (final int value in values) {
result += value;
}
return result;

View File

@@ -71,7 +71,7 @@ void main() {
String consumeSpan(Iterable<InlineSpanSemanticsInformation> items) {
String result = '';
for (InlineSpanSemanticsInformation span in items) {
for (final InlineSpanSemanticsInformation span in items) {
result += span.text;
}
return result;
@@ -81,7 +81,7 @@ String consumeSpan(Iterable<InlineSpanSemanticsInformation> items) {
Iterable<InlineSpanSemanticsInformation> combineSemanticsInfoSyncStar(List<InlineSpanSemanticsInformation> inputs) sync* {
String workingText = '';
String workingLabel;
for (InlineSpanSemanticsInformation info in inputs) {
for (final InlineSpanSemanticsInformation info in inputs) {
if (info.requiresOwnNode) {
if (workingText != null) {
yield InlineSpanSemanticsInformation(workingText, semanticsLabel: workingLabel ?? workingText);
@@ -110,7 +110,7 @@ Iterable<InlineSpanSemanticsInformation> combineSemanticsInfoList(List<InlineSpa
String workingText = '';
String workingLabel;
final List<InlineSpanSemanticsInformation> result = <InlineSpanSemanticsInformation>[];
for (InlineSpanSemanticsInformation info in inputs) {
for (final InlineSpanSemanticsInformation info in inputs) {
if (info.requiresOwnNode) {
if (workingText != null) {
result.add(InlineSpanSemanticsInformation(workingText, semanticsLabel: workingLabel ?? workingText));