diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart index 963fd1710d..e5ff064a7d 100644 --- a/packages/flutter_test/lib/src/binding.dart +++ b/packages/flutter_test/lib/src/binding.dart @@ -154,7 +154,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase Future setLocale(String languageCode, String countryCode) { return TestAsyncUtils.guard(() async { assert(inTest); - Locale locale = new Locale(languageCode, countryCode); + final Locale locale = new Locale(languageCode, countryCode); dispatchLocaleChanged(locale); return null; }); @@ -220,7 +220,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase /// null in that case. dynamic takeException() { assert(inTest); - dynamic result = _pendingExceptionDetails?.exception; + final dynamic result = _pendingExceptionDetails?.exception; _pendingExceptionDetails = null; return result; } @@ -315,7 +315,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase } }; _currentTestCompleter = new Completer(); - ZoneSpecification errorHandlingZoneSpecification = new ZoneSpecification( + final ZoneSpecification errorHandlingZoneSpecification = new ZoneSpecification( handleUncaughtError: (Zone self, ZoneDelegate parent, Zone zone, dynamic exception, StackTrace stack) { if (_currentTestCompleter.isCompleted) { // Well this is not a good sign. @@ -388,7 +388,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase } ); _parentZone = Zone.current; - Zone testZone = _parentZone.fork(specification: errorHandlingZoneSpecification); + final Zone testZone = _parentZone.fork(specification: errorHandlingZoneSpecification); testZone.runBinaryGuarded(_runTestBody, testBody, invariantTester) .whenComplete(_testCompletionHandler); asyncBarrier(); // When using AutomatedTestWidgetsFlutterBinding, this flushes the microtasks. @@ -498,7 +498,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { @override Future idle() { - Future result = super.idle(); + final Future result = super.idle(); _fakeAsync.flushMicrotasks(); return result; } @@ -755,16 +755,16 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { @override Point globalToLocal(Point point) { - Matrix4 transform = renderView.configuration.toHitTestMatrix(); - double det = transform.invert(); + final Matrix4 transform = renderView.configuration.toHitTestMatrix(); + final double det = transform.invert(); assert(det != 0.0); - Point result = MatrixUtils.transformPoint(transform, point); + final Point result = MatrixUtils.transformPoint(transform, point); return result; } @override Point localToGlobal(Point point) { - Matrix4 transform = renderView.configuration.toHitTestMatrix(); + final Matrix4 transform = renderView.configuration.toHitTestMatrix(); return MatrixUtils.transformPoint(transform, point); } } @@ -853,8 +853,8 @@ class _LiveTestRenderView extends RenderView { @override bool hitTest(HitTestResult result, { Point position }) { - Matrix4 transform = configuration.toHitTestMatrix(); - double det = transform.invert(); + final Matrix4 transform = configuration.toHitTestMatrix(); + final double det = transform.invert(); assert(det != 0.0); position = MatrixUtils.transformPoint(transform, position); return super.hitTest(result, position: position); @@ -878,7 +878,7 @@ class _LiveTestRenderView extends RenderView { ..style = PaintingStyle.stroke; bool dirty = false; for (int pointer in _pointers.keys) { - _LiveTestPointerRecord record = _pointers[pointer]; + final _LiveTestPointerRecord record = _pointers[pointer]; paint.color = record.color.withOpacity(record.decay < 0 ? (record.decay / (_kPointerDecay - 1)) : 1.0); canvas.drawPath(path.shift(record.position.toOffset()), paint); if (record.decay < 0) diff --git a/packages/flutter_test/lib/src/controller.dart b/packages/flutter_test/lib/src/controller.dart index c22e57a50c..89273bfc02 100644 --- a/packages/flutter_test/lib/src/controller.dart +++ b/packages/flutter_test/lib/src/controller.dart @@ -75,7 +75,7 @@ class WidgetController { Iterable widgetList(Finder finder) { TestAsyncUtils.guardSync(); return finder.evaluate().map((Element element) { - T result = element.widget; + final T result = element.widget; return result; }); } @@ -223,7 +223,7 @@ class WidgetController { Iterable renderObjectList(Finder finder) { TestAsyncUtils.guardSync(); return finder.evaluate().map((Element element) { - T result = element.renderObject; + final T result = element.renderObject; return result; }); } @@ -235,7 +235,7 @@ class WidgetController { TestAsyncUtils.guardSync(); yield layer; if (layer is ContainerLayer) { - ContainerLayer root = layer; + final ContainerLayer root = layer; Layer child = root.firstChild; while (child != null) { yield* _walkLayers(child); @@ -259,7 +259,7 @@ class WidgetController { /// location. Future tapAt(Point location, { int pointer: 1 }) { return TestAsyncUtils.guard(() async { - TestGesture gesture = await startGesture(location, pointer: pointer); + final TestGesture gesture = await startGesture(location, pointer: pointer); await gesture.up(); return null; }); @@ -278,7 +278,7 @@ class WidgetController { /// a delay of [kLongPressTimeout] + [kPressTimeout] between the two events. Future longPressAt(Point location, { int pointer: 1 }) { return TestAsyncUtils.guard(() async { - TestGesture gesture = await startGesture(location, pointer: pointer); + final TestGesture gesture = await startGesture(location, pointer: pointer); await pump(kLongPressTimeout + kPressTimeout); await gesture.up(); return null; @@ -360,7 +360,7 @@ class WidgetController { /// the given offset, and a pointer up. Future scrollAt(Point startLocation, Offset offset, { int pointer: 1 }) { return TestAsyncUtils.guard(() async { - TestGesture gesture = await startGesture(startLocation, pointer: pointer); + final TestGesture gesture = await startGesture(startLocation, pointer: pointer); await gesture.moveBy(offset); await gesture.up(); return null; @@ -421,8 +421,8 @@ class WidgetController { Point _getElementPoint(Finder finder, Point sizeToPoint(Size size)) { TestAsyncUtils.guardSync(); - Element element = finder.evaluate().single; - RenderBox box = element.renderObject; + final Element element = finder.evaluate().single; + final RenderBox box = element.renderObject; assert(box != null); return box.localToGlobal(sizeToPoint(box.size)); } @@ -431,8 +431,8 @@ class WidgetController { /// the widget's render object has been laid out at least once. Size getSize(Finder finder) { TestAsyncUtils.guardSync(); - Element element = finder.evaluate().single; - RenderBox box = element.renderObject; + final Element element = finder.evaluate().single; + final RenderBox box = element.renderObject; assert(box != null); return box.size; } diff --git a/packages/flutter_test/lib/src/finders.dart b/packages/flutter_test/lib/src/finders.dart index fdf0350424..7cd74f8fb7 100644 --- a/packages/flutter_test/lib/src/finders.dart +++ b/packages/flutter_test/lib/src/finders.dart @@ -341,7 +341,7 @@ class _TextFinder extends MatchFinder { bool matches(Element candidate) { if (candidate.widget is! Text) return false; - Text textWidget = candidate.widget; + final Text textWidget = candidate.widget; return textWidget.data == text; } } @@ -358,7 +358,7 @@ class _IconFinder extends MatchFinder { bool matches(Element candidate) { if (candidate.widget is! Icon) return false; - Icon iconWidget = candidate.widget; + final Icon iconWidget = candidate.widget; return iconWidget.icon == icon; } } @@ -379,7 +379,7 @@ class _WidgetWithTextFinder extends Finder { if (textElement.widget is! Text) return null; - Text textWidget = textElement.widget; + final Text textWidget = textElement.widget; if (textWidget.data == text) { try { textElement.visitAncestorElements((Element element) { diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart index f876cac1c2..a3bb1d658b 100644 --- a/packages/flutter_test/lib/src/matchers.dart +++ b/packages/flutter_test/lib/src/matchers.dart @@ -100,7 +100,7 @@ class _FindsWidgetMatcher extends Matcher { assert(min == null || max == null || min <= max); matchState[Finder] = finder; int count = 0; - Iterator iterator = finder.evaluate().iterator; + final Iterator iterator = finder.evaluate().iterator; if (min != null) { while (count < min && iterator.moveNext()) count += 1; @@ -146,8 +146,8 @@ class _FindsWidgetMatcher extends Matcher { Map matchState, bool verbose ) { - Finder finder = matchState[Finder]; - int count = finder.evaluate().length; + final Finder finder = matchState[Finder]; + final int count = finder.evaluate().length; if (count == 0) { assert(min != null && min > 0); if (min == 1 && max == 1) @@ -167,7 +167,7 @@ class _FindsWidgetMatcher extends Matcher { } bool _hasAncestorMatching(Finder finder, bool predicate(Widget widget)) { - Iterable nodes = finder.evaluate(); + final Iterable nodes = finder.evaluate(); if (nodes.length != 1) return false; bool result = false; @@ -206,12 +206,12 @@ class _IsOnstage extends Matcher { @override bool matches(covariant Finder finder, Map matchState) { - Iterable nodes = finder.evaluate(); + final Iterable nodes = finder.evaluate(); if (nodes.length != 1) return false; bool result = true; nodes.single.visitAncestorElements((Element ancestor) { - Widget widget = ancestor.widget; + final Widget widget = ancestor.widget; if (widget is Offstage) { result = !widget.offstage; return false; @@ -250,7 +250,7 @@ class _HasOneLineDescription extends Matcher { @override bool matches(Object object, Map matchState) { - String description = object.toString(); + final String description = object.toString(); return description.isNotEmpty && !description.contains('\n') && !description.contains('Instance of ') diff --git a/packages/flutter_test/lib/src/stack_manipulation.dart b/packages/flutter_test/lib/src/stack_manipulation.dart index d23d8d6ff8..a61381a7f7 100644 --- a/packages/flutter_test/lib/src/stack_manipulation.dart +++ b/packages/flutter_test/lib/src/stack_manipulation.dart @@ -23,7 +23,7 @@ int reportExpectCall(StackTrace stack, StringBuffer information) { line2.firstMatch(stackLines[2]) != null && line3.firstMatch(stackLines[3]) != null ) { - Match expectMatch = line4.firstMatch(stackLines[4]); + final Match expectMatch = line4.firstMatch(stackLines[4]); assert(expectMatch != null); assert(expectMatch.groupCount == 2); information.writeln('This was caught by the test expectation on the following line:'); @@ -31,4 +31,4 @@ int reportExpectCall(StackTrace stack, StringBuffer information) { return 4; } return 0; -} \ No newline at end of file +} diff --git a/packages/flutter_test/lib/src/test_async_utils.dart b/packages/flutter_test/lib/src/test_async_utils.dart index ffdf22f098..fdd7f17f7d 100644 --- a/packages/flutter_test/lib/src/test_async_utils.dart +++ b/packages/flutter_test/lib/src/test_async_utils.dart @@ -59,20 +59,20 @@ class TestAsyncUtils { /// This method first calls [guardSync]. static Future guard(Future body()) { guardSync(); - Zone zone = Zone.current.fork( + final Zone zone = Zone.current.fork( zoneValues: { _scopeStack: true // so we can recognize this as our own zone } ); - _AsyncScope scope = new _AsyncScope(StackTrace.current, zone); + final _AsyncScope scope = new _AsyncScope(StackTrace.current, zone); _scopeStack.add(scope); - Future result = scope.zone.run(body); + final Future result = scope.zone.run(body); void completionHandler(dynamic error, StackTrace stack) { assert(_scopeStack.isNotEmpty); assert(_scopeStack.contains(scope)); bool leaked = false; _AsyncScope closedScope; - StringBuffer message = new StringBuffer(); + final StringBuffer message = new StringBuffer(); while (_scopeStack.isNotEmpty) { closedScope = _scopeStack.removeLast(); if (closedScope == scope) @@ -177,7 +177,7 @@ class TestAsyncUtils { assert(candidateScope.zone != null); } while (candidateScope.zone != zone); assert(scope != null); - StringBuffer message = new StringBuffer(); + final StringBuffer message = new StringBuffer(); message.writeln('Guarded function conflict. You must use "await" with all Future-returning test APIs.'); final _StackEntry originalGuarder = _findResponsibleMethod(scope.creationStack, 'guard', message); final _StackEntry collidingGuarder = _findResponsibleMethod(StackTrace.current, 'guardSync', message); @@ -261,7 +261,7 @@ class TestAsyncUtils { /// This is used at the end of tests to ensure that nothing leaks out of the test. static void verifyAllScopesClosed() { if (_scopeStack.isNotEmpty) { - StringBuffer message = new StringBuffer(); + final StringBuffer message = new StringBuffer(); message.writeln('Asynchronous call to guarded function leaked. You must use "await" with all Future-returning test APIs.'); for (_AsyncScope scope in _scopeStack) { final _StackEntry guarder = _findResponsibleMethod(scope.creationStack, 'guard', message); diff --git a/packages/flutter_test/lib/src/test_pointer.dart b/packages/flutter_test/lib/src/test_pointer.dart index 083259cdeb..75e20bd560 100644 --- a/packages/flutter_test/lib/src/test_pointer.dart +++ b/packages/flutter_test/lib/src/test_pointer.dart @@ -61,7 +61,7 @@ class TestPointer { /// argument. PointerMoveEvent move(Point newLocation, { Duration timeStamp: Duration.ZERO }) { assert(isDown); - Offset delta = newLocation - location; + final Offset delta = newLocation - location; _location = newLocation; return new PointerMoveEvent( timeStamp: timeStamp, diff --git a/packages/flutter_test/lib/src/test_text_input.dart b/packages/flutter_test/lib/src/test_text_input.dart index 9464535802..7c60e707d1 100644 --- a/packages/flutter_test/lib/src/test_text_input.dart +++ b/packages/flutter_test/lib/src/test_text_input.dart @@ -44,11 +44,11 @@ class TestTextInput { void updateEditingState(TextEditingState state) { expect(_client, isNonZero); - String message = JSON.encode({ + final String message = JSON.encode({ 'method': 'TextInputClient.updateEditingState', 'args': [_client, state.toJSON()], }); - Uint8List encoded = UTF8.encoder.convert(message); + final Uint8List encoded = UTF8.encoder.convert(message); PlatformMessages.handlePlatformMessage( _kTextInputClientChannel, encoded.buffer.asByteData(), (_) {}); } diff --git a/packages/flutter_test/lib/src/widget_tester.dart b/packages/flutter_test/lib/src/widget_tester.dart index 62ae487d38..a56aa8ab26 100644 --- a/packages/flutter_test/lib/src/widget_tester.dart +++ b/packages/flutter_test/lib/src/widget_tester.dart @@ -47,8 +47,8 @@ void testWidgets(String description, WidgetTesterCallback callback, { bool skip: false, test_package.Timeout timeout }) { - TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized(); - WidgetTester tester = new WidgetTester._(binding); + final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized(); + final WidgetTester tester = new WidgetTester._(binding); timeout ??= binding.defaultTestTimeout; test_package.group('-', () { test_package.test(description, () => binding.runTest(() => callback(tester), tester._endOfTestVerifications), skip: skip); @@ -106,9 +106,9 @@ Future benchmarkWidgets(WidgetTesterCallback callback) { print('└─────────────────────────────────────────────────╌┄┈ 🐢'); return true; }); - TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized(); + final TestWidgetsFlutterBinding binding = TestWidgetsFlutterBinding.ensureInitialized(); assert(binding is! AutomatedTestWidgetsFlutterBinding); - WidgetTester tester = new WidgetTester._(binding); + final WidgetTester tester = new WidgetTester._(binding); return binding.runTest(() => callback(tester), tester._endOfTestVerifications) ?? new Future.value(); } diff --git a/packages/flutter_test/test/stack_manipulation_test.dart b/packages/flutter_test/test/stack_manipulation_test.dart index 51a9cc68c8..b388fd6bca 100644 --- a/packages/flutter_test/test/stack_manipulation_test.dart +++ b/packages/flutter_test/test/stack_manipulation_test.dart @@ -10,9 +10,9 @@ void main() { expect(false, isTrue); throw 'unexpectedly did not throw'; } catch (e, stack) { - StringBuffer information = new StringBuffer(); + final StringBuffer information = new StringBuffer(); expect(reportExpectCall(stack, information), 4); - List lines = information.toString().split('\n'); + final List lines = information.toString().split('\n'); expect(lines[0], 'This was caught by the test expectation on the following line:'); expect(lines[1], matches(r'^ .*stack_manipulation_test.dart line [0-9]+$')); } @@ -20,7 +20,7 @@ void main() { try { throw null; } catch (e, stack) { - StringBuffer information = new StringBuffer(); + final StringBuffer information = new StringBuffer(); expect(reportExpectCall(stack, information), 0); expect(information.toString(), ''); } diff --git a/packages/flutter_test/test/test_async_utils_test.dart b/packages/flutter_test/test/test_async_utils_test.dart index 1e1d8a4e6e..59c0e754f4 100644 --- a/packages/flutter_test/test/test_async_utils_test.dart +++ b/packages/flutter_test/test/test_async_utils_test.dart @@ -39,14 +39,14 @@ Future guardedHelper(WidgetTester tester) { void main() { test('TestAsyncUtils - one class', () async { - TestAPI testAPI = new TestAPI(); + final TestAPI testAPI = new TestAPI(); Future f1, f2; f1 = testAPI.testGuard1(); try { f2 = testAPI.testGuard2(); throw 'unexpectedly did not throw'; } on FlutterError catch (e) { - List lines = e.message.split('\n'); + final List lines = e.message.split('\n'); real_test.expect(lines[0], 'Guarded function conflict. You must use "await" with all Future-returning test APIs.'); real_test.expect(lines[1], matches(r'The guarded method "testGuard1" from class TestAPI was called from .*test_async_utils_test.dart on line [0-9]+\.')); real_test.expect(lines[2], matches(r'Then, the "testGuard2" method \(also from class TestAPI\) was called from .*test_async_utils_test.dart on line [0-9]+\.')); @@ -60,14 +60,14 @@ void main() { }); test('TestAsyncUtils - two classes, all callers in superclass', () async { - TestAPI testAPI = new TestAPISubclass(); + final TestAPI testAPI = new TestAPISubclass(); Future f1, f2; f1 = testAPI.testGuard1(); try { f2 = testAPI.testGuard2(); throw 'unexpectedly did not throw'; } on FlutterError catch (e) { - List lines = e.message.split('\n'); + final List lines = e.message.split('\n'); real_test.expect(lines[0], 'Guarded function conflict. You must use "await" with all Future-returning test APIs.'); real_test.expect(lines[1], matches(r'^The guarded method "testGuard1" from class TestAPI was called from .*test_async_utils_test.dart on line [0-9]+\.$')); real_test.expect(lines[2], matches(r'^Then, the "testGuard2" method \(also from class TestAPI\) was called from .*test_async_utils_test.dart on line [0-9]+\.$')); @@ -81,14 +81,14 @@ void main() { }); test('TestAsyncUtils - two classes, mixed callers', () async { - TestAPISubclass testAPI = new TestAPISubclass(); + final TestAPISubclass testAPI = new TestAPISubclass(); Future f1, f2; f1 = testAPI.testGuard1(); try { f2 = testAPI.testGuard3(); throw 'unexpectedly did not throw'; } on FlutterError catch (e) { - List lines = e.message.split('\n'); + final List lines = e.message.split('\n'); real_test.expect(lines[0], 'Guarded function conflict. You must use "await" with all Future-returning test APIs.'); real_test.expect(lines[1], matches(r'^The guarded method "testGuard1" from class TestAPI was called from .*test_async_utils_test.dart on line [0-9]+\.$')); real_test.expect(lines[2], matches(r'^Then, the "testGuard3" method from class TestAPISubclass was called from .*test_async_utils_test.dart on line [0-9]+\.$')); @@ -102,14 +102,14 @@ void main() { }); test('TestAsyncUtils - expect() catches pending async work', () async { - TestAPI testAPI = new TestAPISubclass(); + final TestAPI testAPI = new TestAPISubclass(); Future f1; f1 = testAPI.testGuard1(); try { flutter_test.expect(0, 0); throw 'unexpectedly did not throw'; } on FlutterError catch (e) { - List lines = e.message.split('\n'); + final List lines = e.message.split('\n'); real_test.expect(lines[0], 'Guarded function conflict. You must use "await" with all Future-returning test APIs.'); real_test.expect(lines[1], matches(r'^The guarded method "testGuard1" from class TestAPI was called from .*test_async_utils_test.dart on line [0-9]+\.$')); real_test.expect(lines[2], matches(r'^Then, the "expect" function was called from .*test_async_utils_test.dart on line [0-9]+\.$')); @@ -129,7 +129,7 @@ void main() { f2 = tester.pump(); throw 'unexpectedly did not throw'; } on FlutterError catch (e) { - List lines = e.message.split('\n'); + final List lines = e.message.split('\n'); real_test.expect(lines[0], 'Guarded function conflict. You must use "await" with all Future-returning test APIs.'); real_test.expect(lines[1], matches(r'^The guarded method "pump" from class WidgetTester was called from .*test_async_utils_test.dart on line [0-9]+\.$')); real_test.expect(lines[2], matches(r'^Then, it was called from .*test_async_utils_test.dart on line [0-9]+\.$')); @@ -149,7 +149,7 @@ void main() { TestAsyncUtils.verifyAllScopesClosed(); throw 'unexpectedly did not throw'; } on FlutterError catch (e) { - List lines = e.message.split('\n'); + final List lines = e.message.split('\n'); real_test.expect(lines[0], 'Asynchronous call to guarded function leaked. You must use "await" with all Future-returning test APIs.'); real_test.expect(lines[1], matches(r'^The guarded method "pump" from class WidgetTester was called from .*test_async_utils_test.dart on line [0-9]+, but never completed before its parent scope closed\.$')); real_test.expect(lines[2], matches(r'^The guarded method "pump" from class AutomatedTestWidgetsFlutterBinding was called from [^ ]+ on line [0-9]+, but never completed before its parent scope closed\.')); @@ -165,7 +165,7 @@ void main() { TestAsyncUtils.verifyAllScopesClosed(); throw 'unexpectedly did not throw'; } on FlutterError catch (e) { - List lines = e.message.split('\n'); + final List lines = e.message.split('\n'); real_test.expect(lines[0], 'Asynchronous call to guarded function leaked. You must use "await" with all Future-returning test APIs.'); real_test.expect(lines[1], matches(r'^The guarded method "pump" from class WidgetTester was called from .*test_async_utils_test.dart on line [0-9]+, but never completed before its parent scope closed\.$')); real_test.expect(lines[2], matches(r'^The guarded method "pump" from class AutomatedTestWidgetsFlutterBinding was called from [^ ]+ on line [0-9]+, but never completed before its parent scope closed\.')); diff --git a/packages/flutter_test/test/widget_tester_test.dart b/packages/flutter_test/test/widget_tester_test.dart index 1f4834eac6..bf8b3b1150 100644 --- a/packages/flutter_test/test/widget_tester_test.dart +++ b/packages/flutter_test/test/widget_tester_test.dart @@ -21,7 +21,7 @@ void main() { } expect(failure, isNotNull); - String message = failure.message; + final String message = failure.message; expect(message, contains('Expected: exactly one matching node in the widget tree\n')); expect(message, contains('Actual: ?:\n')); expect(message, contains('Which: means none were found but one was expected\n')); @@ -44,7 +44,7 @@ void main() { } expect(failure, isNotNull); - String message = failure.message; + final String message = failure.message; expect(message, contains('Expected: no matching nodes in the widget tree\n')); expect(message, contains('Actual: ?:\n')); @@ -62,7 +62,7 @@ void main() { } expect(failure, isNotNull); - String message = failure.message; + final String message = failure.message; expect(message, contains('Expected: no matching nodes in the widget tree\n')); expect(message, contains('Actual: ?:\n')); @@ -73,7 +73,7 @@ void main() { await tester.pumpWidget(new Text('foo')); int count; - AnimationController test = new AnimationController( + final AnimationController test = new AnimationController( duration: const Duration(milliseconds: 5100), vsync: tester, ); @@ -108,7 +108,7 @@ void main() { testWidgets('fails with a custom description in the message', (WidgetTester tester) async { await tester.pumpWidget(new Text('foo')); - String customDescription = 'custom description'; + final String customDescription = 'custom description'; TestFailure failure; try { expect(find.byElementPredicate((_) => false, description: customDescription), findsOneWidget); @@ -125,7 +125,7 @@ void main() { testWidgets('fails with a custom description in the message', (WidgetTester tester) async { await tester.pumpWidget(new Text('foo')); - String customDescription = 'custom description'; + final String customDescription = 'custom description'; TestFailure failure; try { expect(find.byWidgetPredicate((_) => false, description: customDescription), findsOneWidget);