Declare locals as final where not reassigned (dev) (#8574)

This commit is contained in:
Chris Bracken
2017-03-03 18:06:08 -08:00
committed by GitHub
parent 7a52fb6772
commit 6c97dd2c6c
35 changed files with 215 additions and 215 deletions

View File

@@ -449,7 +449,7 @@ class ItemGalleryBox extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<String> tabNames = <String>[
final List<String> tabNames = <String>[
'A', 'B', 'C', 'D'
];

View File

@@ -20,9 +20,9 @@ void main() {
});
test('measure', () async {
Timeline timeline = await driver.traceAction(() async {
final Timeline timeline = await driver.traceAction(() async {
// Find the scrollable stock list
SerializableFinder stockList = find.byValueKey('main-scroll');
final SerializableFinder stockList = find.byValueKey('main-scroll');
expect(stockList, isNotNull);
// Scroll down
@@ -38,7 +38,7 @@ void main() {
}
});
TimelineSummary summary = new TimelineSummary.summarize(timeline);
final TimelineSummary summary = new TimelineSummary.summarize(timeline);
summary.writeSummaryToFile('complex_layout_scroll_perf', pretty: true);
summary.writeTimelineToFile('complex_layout_scroll_perf', pretty: true);
});

View File

@@ -54,7 +54,7 @@ class BenchmarkResultPrinter {
}
String _printPlainText() {
StringBuffer buf = new StringBuffer();
final StringBuffer buf = new StringBuffer();
for (_BenchmarkResult result in _results) {
buf.writeln('${result.description}: ${result.value.toStringAsFixed(1)} ${result.unit}');
}

View File

@@ -24,7 +24,7 @@ void main() {
}
watch.stop();
BenchmarkResultPrinter printer = new BenchmarkResultPrinter();
final BenchmarkResultPrinter printer = new BenchmarkResultPrinter();
printer.addResult(
description: 'Velocity tracker',
value: watch.elapsedMicroseconds / _kNumIters,

View File

@@ -75,7 +75,7 @@ Future<Null> main() async {
}
});
BenchmarkResultPrinter printer = new BenchmarkResultPrinter();
final BenchmarkResultPrinter printer = new BenchmarkResultPrinter();
printer.addResult(
description: 'Stock animation',
value: wallClockWatch.elapsedMicroseconds / (1000 * 1000),

View File

@@ -21,7 +21,7 @@ Future<Null> main() async {
// This allows us to call onBeginFrame even when the engine didn't request it,
// and have it actually do something:
LiveTestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
final LiveTestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
binding.allowAllFrames = true;
final Stopwatch watch = new Stopwatch();
@@ -50,7 +50,7 @@ Future<Null> main() async {
watch.stop();
});
BenchmarkResultPrinter printer = new BenchmarkResultPrinter();
final BenchmarkResultPrinter printer = new BenchmarkResultPrinter();
printer.addResult(
description: 'Stock build',
value: watch.elapsedMicroseconds / iterations,

View File

@@ -20,7 +20,7 @@ Future<Null> main() async {
// This allows us to call onBeginFrame even when the engine didn't request it,
// and have it actually do something:
LiveTestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
final LiveTestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized();
binding.allowAllFrames = true;
final Stopwatch watch = new Stopwatch();
@@ -51,7 +51,7 @@ Future<Null> main() async {
watch.stop();
});
BenchmarkResultPrinter printer = new BenchmarkResultPrinter();
final BenchmarkResultPrinter printer = new BenchmarkResultPrinter();
printer.addResult(
description: 'Stock layout',
value: watch.elapsedMicroseconds / iterations,