Unverified Commit 53b63581 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Re-enable missing_return (#20844)

parent 458d0b3d
...@@ -26,9 +26,8 @@ analyzer: ...@@ -26,9 +26,8 @@ analyzer:
errors: errors:
# treat missing required parameters as a warning (not a hint) # treat missing required parameters as a warning (not a hint)
missing_required_param: warning missing_required_param: warning
# TODO(devoncarew): https://github.com/flutter/flutter/issues/20114
# treat missing returns as a warning (not a hint) # treat missing returns as a warning (not a hint)
missing_return: ignore missing_return: warning
# allow having TODOs in the code # allow having TODOs in the code
todo: ignore todo: ignore
exclude: exclude:
......
...@@ -600,6 +600,7 @@ Future<Null> _verifyNoTestPackageImports(String workingDirectory) async { ...@@ -600,6 +600,7 @@ Future<Null> _verifyNoTestPackageImports(String workingDirectory) async {
} }
return ' $name: uses \'package:test\' directly'; return ' $name: uses \'package:test\' directly';
} }
return null;
}) })
.where((String line) => line != null) .where((String line) => line != null)
.toList() .toList()
......
...@@ -141,7 +141,7 @@ Future<Map<String, double>> _readJsonResults(Process process) { ...@@ -141,7 +141,7 @@ Future<Map<String, double>> _readJsonResults(Process process) {
jsonBuf.writeln(line.substring(line.indexOf(jsonPrefix) + jsonPrefix.length)); jsonBuf.writeln(line.substring(line.indexOf(jsonPrefix) + jsonPrefix.length));
}); });
process.exitCode.then<int>((int code) async { process.exitCode.then<void>((int code) async {
await Future.wait<void>(<Future<void>>[ await Future.wait<void>(<Future<void>>[
stdoutSub.cancel(), stdoutSub.cancel(),
stderrSub.cancel(), stderrSub.cancel(),
......
...@@ -58,6 +58,7 @@ Future<Null> main(List<String> rawArgs) async { ...@@ -58,6 +58,7 @@ Future<Null> main(List<String> rawArgs) async {
(String line) => line.startsWith('intl:'), (String line) => line.startsWith('intl:'),
orElse: () { orElse: () {
exitWithError('intl dependency not found in ${dotPackagesFile.path}'); exitWithError('intl dependency not found in ${dotPackagesFile.path}');
return null; // unreachable
}, },
) )
.split(':') .split(':')
......
...@@ -71,6 +71,7 @@ class CupertinoNavigationDemo extends StatelessWidget { ...@@ -71,6 +71,7 @@ class CupertinoNavigationDemo extends StatelessWidget {
], ],
), ),
tabBuilder: (BuildContext context, int index) { tabBuilder: (BuildContext context, int index) {
assert(index >= 0 && index <= 2);
switch (index) { switch (index) {
case 0: case 0:
return new CupertinoTabView( return new CupertinoTabView(
...@@ -95,8 +96,8 @@ class CupertinoNavigationDemo extends StatelessWidget { ...@@ -95,8 +96,8 @@ class CupertinoNavigationDemo extends StatelessWidget {
defaultTitle: 'Account', defaultTitle: 'Account',
); );
break; break;
default:
} }
return null;
}, },
), ),
), ),
......
...@@ -155,7 +155,8 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke ...@@ -155,7 +155,8 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
controller: _controller, controller: _controller,
isScrollable: true, isScrollable: true,
indicator: getIndicator(), indicator: getIndicator(),
tabs: _allPages.map((_Page page) { tabs: _allPages.map<Tab>((_Page page) {
assert(_demoStyle != null);
switch (_demoStyle) { switch (_demoStyle) {
case TabsDemoStyle.iconsAndText: case TabsDemoStyle.iconsAndText:
return new Tab(text: page.text, icon: new Icon(page.icon)); return new Tab(text: page.text, icon: new Icon(page.icon));
...@@ -164,6 +165,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke ...@@ -164,6 +165,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
case TabsDemoStyle.textOnly: case TabsDemoStyle.textOnly:
return new Tab(text: page.text); return new Tab(text: page.text);
} }
return null;
}).toList(), }).toList(),
), ),
), ),
......
...@@ -156,7 +156,7 @@ Future<Null> runDemos(List<String> demos, FlutterDriver driver) async { ...@@ -156,7 +156,7 @@ Future<Null> runDemos(List<String> demos, FlutterDriver driver) async {
await driver.tap(demoItem); // Launch the demo await driver.tap(demoItem); // Launch the demo
if (kUnsynchronizedDemos.contains(demo)) { if (kUnsynchronizedDemos.contains(demo)) {
await driver.runUnsynchronized<Future<Null>>(() async { await driver.runUnsynchronized<void>(() async {
await driver.tap(find.byTooltip('Back')); await driver.tap(find.byTooltip('Back'));
}); });
} else { } else {
......
...@@ -12,7 +12,7 @@ void main() { ...@@ -12,7 +12,7 @@ void main() {
expect(const SectorConstraints().isTight, isFalse); expect(const SectorConstraints().isTight, isFalse);
}); });
testWidgets('Sector Sixes', (WidgetTester tester) { testWidgets('Sector Sixes', (WidgetTester tester) async {
tester.pumpWidget(new SectorApp()); await tester.pumpWidget(new SectorApp());
}); });
} }
...@@ -6,7 +6,7 @@ import 'package:flutter_examples_layers/main.dart' as demo; ...@@ -6,7 +6,7 @@ import 'package:flutter_examples_layers/main.dart' as demo;
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('layers smoketest for lib/main.dart', (WidgetTester tester) { testWidgets('layers smoketest for lib/main.dart', (WidgetTester tester) async {
demo.main(); demo.main();
}); });
} }
...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../../../services/isolate.dart' as demo; import '../../../services/isolate.dart' as demo;
void main() { void main() {
testWidgets('layers smoketest for services/isolate.dart', (WidgetTester tester) { testWidgets('layers smoketest for services/isolate.dart', (WidgetTester tester) async {
demo.main(); demo.main();
}); });
} }
...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../../../services/lifecycle.dart' as demo; import '../../../services/lifecycle.dart' as demo;
void main() { void main() {
testWidgets('layers smoketest for services/lifecycle.dart', (WidgetTester tester) { testWidgets('layers smoketest for services/lifecycle.dart', (WidgetTester tester) async {
demo.main(); demo.main();
}); });
} }
...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/custom_render_box.dart' as demo; import '../../../widgets/custom_render_box.dart' as demo;
void main() { void main() {
testWidgets('layers smoketest for widgets/custom_render_box.dart', (WidgetTester tester) { testWidgets('layers smoketest for widgets/custom_render_box.dart', (WidgetTester tester) async {
demo.main(); demo.main();
}); });
} }
...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/gestures.dart' as demo; import '../../../widgets/gestures.dart' as demo;
void main() { void main() {
testWidgets('layers smoketest for widgets/gestures.dart', (WidgetTester tester) { testWidgets('layers smoketest for widgets/gestures.dart', (WidgetTester tester) async {
demo.main(); demo.main();
}); });
} }
...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/hello_world.dart' as demo; import '../../../widgets/hello_world.dart' as demo;
void main() { void main() {
testWidgets('layers smoketest for widgets/hello_world.dart', (WidgetTester tester) { testWidgets('layers smoketest for widgets/hello_world.dart', (WidgetTester tester) async {
demo.main(); demo.main();
}); });
} }
...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/media_query.dart' as demo; import '../../../widgets/media_query.dart' as demo;
void main() { void main() {
testWidgets('layers smoketest for widgets/media_query.dart', (WidgetTester tester) { testWidgets('layers smoketest for widgets/media_query.dart', (WidgetTester tester) async {
demo.main(); demo.main();
}); });
} }
...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/sectors.dart' as demo; import '../../../widgets/sectors.dart' as demo;
void main() { void main() {
testWidgets('layers smoketest for widgets/sectors.dart', (WidgetTester tester) { testWidgets('layers smoketest for widgets/sectors.dart', (WidgetTester tester) async {
demo.main(); demo.main();
}); });
} }
...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/spinning_square.dart' as demo; import '../../../widgets/spinning_square.dart' as demo;
void main() { void main() {
testWidgets('layers smoketest for widgets/spinning_square.dart', (WidgetTester tester) { testWidgets('layers smoketest for widgets/spinning_square.dart', (WidgetTester tester) async {
demo.main(); demo.main();
}); });
} }
...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
import '../../../widgets/styled_text.dart' as demo; import '../../../widgets/styled_text.dart' as demo;
void main() { void main() {
testWidgets('layers smoketest for widgets/styled_text.dart', (WidgetTester tester) { testWidgets('layers smoketest for widgets/styled_text.dart', (WidgetTester tester) async {
demo.main(); demo.main();
}); });
} }
...@@ -26,9 +26,6 @@ analyzer: ...@@ -26,9 +26,6 @@ analyzer:
errors: errors:
# treat missing required parameters as a warning (not a hint) # treat missing required parameters as a warning (not a hint)
missing_required_param: warning missing_required_param: warning
# treat missing returns as a warning (not a hint)
# TODO(ianh): https://github.com/flutter/flutter/issues/20114
missing_return: ignore
# allow having TODOs in the code # allow having TODOs in the code
todo: ignore todo: ignore
......
...@@ -313,6 +313,11 @@ class MethodChannel { ...@@ -313,6 +313,11 @@ class MethodChannel {
/// ///
/// This is intended for testing. Method calls intercepted in this manner are /// This is intended for testing. Method calls intercepted in this manner are
/// not sent to platform plugins. /// not sent to platform plugins.
///
/// The provided `handler` must return a `Future` that completes with the
/// return value of the call. The value will be encoded using
/// [MethodCodec.encodeSuccessEnvelope], to act as if platform plugin had
/// returned that value.
void setMockMethodCallHandler(Future<dynamic> handler(MethodCall call)) { void setMockMethodCallHandler(Future<dynamic> handler(MethodCall call)) {
BinaryMessages.setMockMessageHandler( BinaryMessages.setMockMessageHandler(
name, name,
...@@ -413,6 +418,7 @@ class EventChannel { ...@@ -413,6 +418,7 @@ class EventChannel {
controller.addError(e); controller.addError(e);
} }
} }
return null;
}); });
try { try {
await methodChannel.invokeMethod('listen', arguments); await methodChannel.invokeMethod('listen', arguments);
......
...@@ -494,14 +494,14 @@ class AndroidViewController { ...@@ -494,14 +494,14 @@ class AndroidViewController {
} }
static int _getAndroidDirection(TextDirection direction) { static int _getAndroidDirection(TextDirection direction) {
assert(direction != null);
switch (direction) { switch (direction) {
case TextDirection.ltr: case TextDirection.ltr:
return kAndroidLayoutDirectionLtr; return kAndroidLayoutDirectionLtr;
case TextDirection.rtl: case TextDirection.rtl:
return kAndroidLayoutDirectionRtl; return kAndroidLayoutDirectionRtl;
default:
throw new UnsupportedError('Direction $direction is not supported');
} }
return null;
} }
/// Sends an Android [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent) /// Sends an Android [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent)
......
...@@ -359,9 +359,11 @@ typedef Widget AsyncWidgetBuilder<T>(BuildContext context, AsyncSnapshot<T> snap ...@@ -359,9 +359,11 @@ typedef Widget AsyncWidgetBuilder<T>(BuildContext context, AsyncSnapshot<T> snap
/// case ConnectionState.active: return new Text('\$${snapshot.data}'); /// case ConnectionState.active: return new Text('\$${snapshot.data}');
/// case ConnectionState.done: return new Text('\$${snapshot.data} (closed)'); /// case ConnectionState.done: return new Text('\$${snapshot.data} (closed)');
/// } /// }
/// return null; // unreachable
/// }, /// },
/// ) /// )
/// ``` /// ```
// TODO(ianh): remove unreachable code above once https://github.com/dart-lang/linter/issues/1141 is fixed
class StreamBuilder<T> extends StreamBuilderBase<T, AsyncSnapshot<T>> { class StreamBuilder<T> extends StreamBuilderBase<T, AsyncSnapshot<T>> {
/// Creates a new [StreamBuilder] that builds itself based on the latest /// Creates a new [StreamBuilder] that builds itself based on the latest
/// snapshot of interaction with the specified [stream] and whose build /// snapshot of interaction with the specified [stream] and whose build
...@@ -491,9 +493,11 @@ class StreamBuilder<T> extends StreamBuilderBase<T, AsyncSnapshot<T>> { ...@@ -491,9 +493,11 @@ class StreamBuilder<T> extends StreamBuilderBase<T, AsyncSnapshot<T>> {
/// return new Text('Error: ${snapshot.error}'); /// return new Text('Error: ${snapshot.error}');
/// return new Text('Result: ${snapshot.data}'); /// return new Text('Result: ${snapshot.data}');
/// } /// }
/// return null; // unreachable
/// }, /// },
/// ) /// )
/// ``` /// ```
// TODO(ianh): remove unreachable code above once https://github.com/dart-lang/linter/issues/1141 is fixed
class FutureBuilder<T> extends StatefulWidget { class FutureBuilder<T> extends StatefulWidget {
/// Creates a widget that builds itself based on the latest snapshot of /// Creates a widget that builds itself based on the latest snapshot of
/// interaction with a [Future]. /// interaction with a [Future].
......
...@@ -321,12 +321,16 @@ class _HeroFlight { ...@@ -321,12 +321,16 @@ class _HeroFlight {
assert(!_aborted); assert(!_aborted);
assert(() { assert(() {
final Animation<double> initial = initialManifest.animation; final Animation<double> initial = initialManifest.animation;
switch (initialManifest.type) { assert(initial != null);
final _HeroFlightType type = initialManifest.type;
assert(type != null);
switch (type) {
case _HeroFlightType.pop: case _HeroFlightType.pop:
return initial.value == 1.0 && initial.status == AnimationStatus.reverse; return initial.value == 1.0 && initial.status == AnimationStatus.reverse;
case _HeroFlightType.push: case _HeroFlightType.push:
return initial.value == 0.0 && initial.status == AnimationStatus.forward; return initial.value == 0.0 && initial.status == AnimationStatus.forward;
} }
return null;
}()); }());
manifest = initialManifest; manifest = initialManifest;
......
...@@ -71,6 +71,7 @@ void main() { ...@@ -71,6 +71,7 @@ void main() {
} }
); );
} }
return null;
}, },
), ),
), ),
...@@ -86,6 +87,7 @@ void main() { ...@@ -86,6 +87,7 @@ void main() {
home: new CupertinoTabView( home: new CupertinoTabView(
onUnknownRoute: (RouteSettings settings) { onUnknownRoute: (RouteSettings settings) {
unknownForRouteCalled = settings.name; unknownForRouteCalled = settings.name;
return null;
}, },
), ),
), ),
......
...@@ -7,7 +7,7 @@ import 'package:flutter/gestures.dart'; ...@@ -7,7 +7,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('debugPrintGestureArenaDiagnostics', (WidgetTester tester) { testWidgets('debugPrintGestureArenaDiagnostics', (WidgetTester tester) async {
PointerEvent event; PointerEvent event;
debugPrintGestureArenaDiagnostics = true; debugPrintGestureArenaDiagnostics = true;
final DebugPrintCallback oldCallback = debugPrint; final DebugPrintCallback oldCallback = debugPrint;
...@@ -53,7 +53,7 @@ void main() { ...@@ -53,7 +53,7 @@ void main() {
debugPrint = oldCallback; debugPrint = oldCallback;
}); });
testWidgets('debugPrintRecognizerCallbacksTrace', (WidgetTester tester) { testWidgets('debugPrintRecognizerCallbacksTrace', (WidgetTester tester) async {
PointerEvent event; PointerEvent event;
debugPrintRecognizerCallbacksTrace = true; debugPrintRecognizerCallbacksTrace = true;
final DebugPrintCallback oldCallback = debugPrint; final DebugPrintCallback oldCallback = debugPrint;
...@@ -95,7 +95,7 @@ void main() { ...@@ -95,7 +95,7 @@ void main() {
debugPrint = oldCallback; debugPrint = oldCallback;
}); });
testWidgets('debugPrintGestureArenaDiagnostics and debugPrintRecognizerCallbacksTrace', (WidgetTester tester) { testWidgets('debugPrintGestureArenaDiagnostics and debugPrintRecognizerCallbacksTrace', (WidgetTester tester) async {
PointerEvent event; PointerEvent event;
debugPrintGestureArenaDiagnostics = true; debugPrintGestureArenaDiagnostics = true;
debugPrintRecognizerCallbacksTrace = true; debugPrintRecognizerCallbacksTrace = true;
......
...@@ -368,9 +368,11 @@ void main() { ...@@ -368,9 +368,11 @@ void main() {
new MaterialApp( new MaterialApp(
onGenerateRoute: (RouteSettings settings) { onGenerateRoute: (RouteSettings settings) {
log.add('onGenerateRoute ${settings.name}'); log.add('onGenerateRoute ${settings.name}');
return null;
}, },
onUnknownRoute: (RouteSettings settings) { onUnknownRoute: (RouteSettings settings) {
log.add('onUnknownRoute ${settings.name}'); log.add('onUnknownRoute ${settings.name}');
return null;
}, },
) )
); );
......
...@@ -250,7 +250,7 @@ void main() { ...@@ -250,7 +250,7 @@ void main() {
testWidgets('has semantic events', (WidgetTester tester) async { testWidgets('has semantic events', (WidgetTester tester) async {
dynamic semanticEvent; dynamic semanticEvent;
bool checkboxValue = false; bool checkboxValue = false;
SystemChannels.accessibility.setMockMessageHandler((dynamic message) { SystemChannels.accessibility.setMockMessageHandler((dynamic message) async {
semanticEvent = message; semanticEvent = message;
}); });
final SemanticsTester semanticsTester = new SemanticsTester(tester); final SemanticsTester semanticsTester = new SemanticsTester(tester);
......
...@@ -29,7 +29,7 @@ void main () { ...@@ -29,7 +29,7 @@ void main () {
setUp(() { setUp(() {
semanticEvents = <Map<String, Object>>[]; semanticEvents = <Map<String, Object>>[];
SystemChannels.accessibility.setMockMessageHandler((dynamic message) { SystemChannels.accessibility.setMockMessageHandler((dynamic message) async {
final Map<dynamic, dynamic> typedMessage = message; final Map<dynamic, dynamic> typedMessage = message;
semanticEvents.add(typedMessage.cast<String, Object>()); semanticEvents.add(typedMessage.cast<String, Object>());
}); });
......
...@@ -10,7 +10,7 @@ import 'package:flutter/services.dart'; ...@@ -10,7 +10,7 @@ import 'package:flutter/services.dart';
/// cannot be used in combination with other classes that do the same. /// cannot be used in combination with other classes that do the same.
class FeedbackTester { class FeedbackTester {
FeedbackTester() { FeedbackTester() {
SystemChannels.platform.setMockMethodCallHandler((MethodCall methodCall) { SystemChannels.platform.setMockMethodCallHandler((MethodCall methodCall) async {
if (methodCall.method == 'HapticFeedback.vibrate') if (methodCall.method == 'HapticFeedback.vibrate')
_hapticCount++; _hapticCount++;
if (methodCall.method == 'SystemSound.play' && if (methodCall.method == 'SystemSound.play' &&
......
...@@ -216,7 +216,7 @@ void main() { ...@@ -216,7 +216,7 @@ void main() {
final Key key = new UniqueKey(); final Key key = new UniqueKey();
dynamic semanticEvent; dynamic semanticEvent;
int radioValue = 2; int radioValue = 2;
SystemChannels.accessibility.setMockMessageHandler((dynamic message) { SystemChannels.accessibility.setMockMessageHandler((dynamic message) async {
semanticEvent = message; semanticEvent = message;
}); });
......
...@@ -358,7 +358,7 @@ void main() { ...@@ -358,7 +358,7 @@ void main() {
home: new RefreshIndicator( home: new RefreshIndicator(
onRefresh: () { onRefresh: () {
refreshCalled = true; refreshCalled = true;
// Missing a returned Future value here. return null; // Missing a returned Future value here, should cause framework to throw.
}, },
child: new ListView( child: new ListView(
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
......
...@@ -274,7 +274,7 @@ void main() { ...@@ -274,7 +274,7 @@ void main() {
testWidgets('switch has semantic events', (WidgetTester tester) async { testWidgets('switch has semantic events', (WidgetTester tester) async {
dynamic semanticEvent; dynamic semanticEvent;
bool value = false; bool value = false;
SystemChannels.accessibility.setMockMessageHandler((dynamic message) { SystemChannels.accessibility.setMockMessageHandler((dynamic message) async {
semanticEvent = message; semanticEvent = message;
}); });
final SemanticsTester semanticsTester = new SemanticsTester(tester); final SemanticsTester semanticsTester = new SemanticsTester(tester);
...@@ -318,7 +318,7 @@ void main() { ...@@ -318,7 +318,7 @@ void main() {
testWidgets('switch sends semantic events from parent if fully merged', (WidgetTester tester) async { testWidgets('switch sends semantic events from parent if fully merged', (WidgetTester tester) async {
dynamic semanticEvent; dynamic semanticEvent;
bool value = false; bool value = false;
SystemChannels.accessibility.setMockMessageHandler((dynamic message) { SystemChannels.accessibility.setMockMessageHandler((dynamic message) async {
semanticEvent = message; semanticEvent = message;
}); });
final SemanticsTester semanticsTester = new SemanticsTester(tester); final SemanticsTester semanticsTester = new SemanticsTester(tester);
......
...@@ -679,7 +679,7 @@ void main() { ...@@ -679,7 +679,7 @@ void main() {
testWidgets('has semantic events', (WidgetTester tester) async { testWidgets('has semantic events', (WidgetTester tester) async {
final List<dynamic> semanticEvents = <dynamic>[]; final List<dynamic> semanticEvents = <dynamic>[];
SystemChannels.accessibility.setMockMessageHandler((dynamic message) { SystemChannels.accessibility.setMockMessageHandler((dynamic message) async {
semanticEvents.add(message); semanticEvents.add(message);
}); });
final SemanticsTester semantics = new SemanticsTester(tester); final SemanticsTester semantics = new SemanticsTester(tester);
......
...@@ -13,6 +13,7 @@ void main() { ...@@ -13,6 +13,7 @@ void main() {
BinaryMessages.setMockMessageHandler('test1', (ByteData message) async { BinaryMessages.setMockMessageHandler('test1', (ByteData message) async {
log.add(message); log.add(message);
return null;
}); });
final ByteData message = new ByteData(2)..setUint16(0, 0xABCD); final ByteData message = new ByteData(2)..setUint16(0, 0xABCD);
......
...@@ -98,7 +98,7 @@ void main() { ...@@ -98,7 +98,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
new TestWidget((BuildContext context) { new TestWidget((BuildContext context) {
disposeCalled = true; disposeCalled = true;
context.visitAncestorElements((Element element) { }); context.visitAncestorElements((Element element) => true);
}), }),
); );
await tester.pumpWidget(new Container()); await tester.pumpWidget(new Container());
......
...@@ -788,7 +788,7 @@ void main() { ...@@ -788,7 +788,7 @@ void main() {
// Verify TextInput.setEditingState is fired with updated text when controller is replaced. // Verify TextInput.setEditingState is fired with updated text when controller is replaced.
final List<MethodCall> log = <MethodCall>[]; final List<MethodCall> log = <MethodCall>[];
SystemChannels.textInput.setMockMethodCallHandler((MethodCall methodCall) { SystemChannels.textInput.setMockMethodCallHandler((MethodCall methodCall) async {
log.add(methodCall); log.add(methodCall);
}); });
setState(() { setState(() {
......
...@@ -1027,9 +1027,9 @@ void main() { ...@@ -1027,9 +1027,9 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new NotificationListener<ScrollNotification>( child: new NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification notification) { onNotification: (ScrollNotification notification) {
if (notification is ScrollUpdateNotification) { if (notification is ScrollUpdateNotification)
scrolledPositions.add(notification.metrics.pixels); scrolledPositions.add(notification.metrics.pixels);
} return false;
}, },
child: new ListWheelScrollView( child: new ListWheelScrollView(
controller: controller, controller: controller,
...@@ -1078,9 +1078,9 @@ void main() { ...@@ -1078,9 +1078,9 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: new NotificationListener<ScrollNotification>( child: new NotificationListener<ScrollNotification>(
onNotification: (ScrollNotification notification) { onNotification: (ScrollNotification notification) {
if (notification is ScrollUpdateNotification) { if (notification is ScrollUpdateNotification)
scrolledPositions.add(notification.metrics.pixels); scrolledPositions.add(notification.metrics.pixels);
} return false;
}, },
child: new ListWheelScrollView( child: new ListWheelScrollView(
controller: controller, controller: controller,
......
...@@ -232,6 +232,7 @@ void main() { ...@@ -232,6 +232,7 @@ void main() {
}, },
); );
} }
return null;
}, },
), ),
), ),
......
...@@ -66,9 +66,10 @@ void main() { ...@@ -66,9 +66,10 @@ void main() {
await tester.pumpWidget(new NotificationListener<MyNotification>( await tester.pumpWidget(new NotificationListener<MyNotification>(
onNotification: (MyNotification value) { onNotification: (MyNotification value) {
log.add(value.runtimeType); log.add(value.runtimeType);
return false;
}, },
child: new NotificationListener<MyNotification>( child: new NotificationListener<MyNotification>(
onNotification: (MyNotification value) { }, onNotification: (MyNotification value) => false,
child: new Container(key: key), child: new Container(key: key),
), ),
)); ));
......
...@@ -108,6 +108,7 @@ void main() { ...@@ -108,6 +108,7 @@ void main() {
case '/3': return new TestRoute<Null>(settings: settings, child: const Text('F')); case '/3': return new TestRoute<Null>(settings: settings, child: const Text('F'));
case '/4': return new TestRoute<Null>(settings: settings, child: const Text('G')); case '/4': return new TestRoute<Null>(settings: settings, child: const Text('G'));
} }
return null;
} }
) )
); );
...@@ -192,6 +193,7 @@ void main() { ...@@ -192,6 +193,7 @@ void main() {
case '/': return new TestRoute<Null>(settings: settings, child: const Text('A')); case '/': return new TestRoute<Null>(settings: settings, child: const Text('A'));
case '/1': return new TestRoute<Null>(settings: settings, barrierColor: const Color(0xFFFFFF00), child: const Text('B')); case '/1': return new TestRoute<Null>(settings: settings, barrierColor: const Color(0xFFFFFF00), child: const Text('B'));
} }
return null;
} }
) )
); );
......
...@@ -21,6 +21,7 @@ void main() { ...@@ -21,6 +21,7 @@ void main() {
(TextEditingValue oldValue, TextEditingValue newValue) { (TextEditingValue oldValue, TextEditingValue newValue) {
calledOldValue = oldValue; calledOldValue = oldValue;
calledNewValue = newValue; calledNewValue = newValue;
return null;
} }
); );
......
...@@ -281,7 +281,7 @@ void main() { ...@@ -281,7 +281,7 @@ void main() {
}); });
test('without clearing timeline', () async { test('without clearing timeline', () async {
final Timeline timeline = await driver.traceAction(() { final Timeline timeline = await driver.traceAction(() async {
log.add('action'); log.add('action');
}, retainPriorEvents: true); }, retainPriorEvents: true);
...@@ -295,7 +295,7 @@ void main() { ...@@ -295,7 +295,7 @@ void main() {
}); });
test('with clearing timeline', () async { test('with clearing timeline', () async {
final Timeline timeline = await driver.traceAction(() { final Timeline timeline = await driver.traceAction(() async {
log.add('action'); log.add('action');
}); });
...@@ -338,7 +338,7 @@ void main() { ...@@ -338,7 +338,7 @@ void main() {
}; };
}); });
final Timeline timeline = await driver.traceAction(() { final Timeline timeline = await driver.traceAction(() async {
actionCalled = true; actionCalled = true;
}, },
streams: const <TimelineStream>[ streams: const <TimelineStream>[
......
...@@ -74,7 +74,7 @@ void main() { ...@@ -74,7 +74,7 @@ void main() {
group('getSemanticsId', () { group('getSemanticsId', () {
FlutterDriverExtension extension; FlutterDriverExtension extension;
setUp(() { setUp(() {
extension = new FlutterDriverExtension((String arg) async {}, true); extension = new FlutterDriverExtension((String arg) async => '', true);
}); });
testWidgets('works when semantics are enabled', (WidgetTester tester) async { testWidgets('works when semantics are enabled', (WidgetTester tester) async {
......
...@@ -1531,14 +1531,14 @@ class _MatchesGoldenFile extends AsyncMatcher { ...@@ -1531,14 +1531,14 @@ class _MatchesGoldenFile extends AsyncMatcher {
return 'Failed to generate screenshot from engine within the 10,000ms timeout.'; return 'Failed to generate screenshot from engine within the 10,000ms timeout.';
if (autoUpdateGoldenFiles) { if (autoUpdateGoldenFiles) {
await goldenFileComparator.update(key, bytes.buffer.asUint8List()); await goldenFileComparator.update(key, bytes.buffer.asUint8List());
} else { return null;
}
try { try {
final bool success = await goldenFileComparator.compare(bytes.buffer.asUint8List(), key); final bool success = await goldenFileComparator.compare(bytes.buffer.asUint8List(), key);
return success ? null : 'does not match'; return success ? null : 'does not match';
} on TestFailure catch (ex) { } on TestFailure catch (ex) {
return ex.message; return ex.message;
} }
}
}, additionalTime: const Duration(seconds: 11)); }, additionalTime: const Duration(seconds: 11));
} }
......
...@@ -500,7 +500,7 @@ void main() { ...@@ -500,7 +500,7 @@ void main() {
final Object key = new Object(); final Object key = new Object();
await runZoned(() { await runZoned(() {
expect(Zone.current[key], 'abczed'); expect(Zone.current[key], 'abczed');
return tester.runAsync<String>(() async { return tester.runAsync<void>(() async {
expect(Zone.current[key], 'abczed'); expect(Zone.current[key], 'abczed');
}); });
}, zoneValues: <dynamic, dynamic>{ }, zoneValues: <dynamic, dynamic>{
......
...@@ -369,7 +369,7 @@ Future<Null> _recompile(StreamController<List<int>> streamController, ...@@ -369,7 +369,7 @@ Future<Null> _recompile(StreamController<List<int>> streamController,
String mockCompilerOutput) async { String mockCompilerOutput) async {
// Put content into the output stream after generator.recompile gets // Put content into the output stream after generator.recompile gets
// going few lines below, resets completer. // going few lines below, resets completer.
new Future<List<int>>(() { scheduleMicrotask(() {
streamController.add(utf8.encode(mockCompilerOutput)); streamController.add(utf8.encode(mockCompilerOutput));
}); });
final CompilerOutput output = await generator.recompile(null /* mainPath */, <String>['/path/to/main.dart']); final CompilerOutput output = await generator.recompile(null /* mainPath */, <String>['/path/to/main.dart']);
......
...@@ -125,8 +125,12 @@ void main() { ...@@ -125,8 +125,12 @@ void main() {
// Crash if called a third time which is unexpected. // Crash if called a third time which is unexpected.
mockTimes = <int>[1000, 2000]; mockTimes = <int>[1000, 2000];
final DummyFlutterCommand flutterCommand = final DummyFlutterCommand flutterCommand = new DummyFlutterCommand(
new DummyFlutterCommand(commandFunction: () async { throwToolExit('fail'); }); commandFunction: () async {
throwToolExit('fail');
return null; // unreachable
},
);
try { try {
await flutterCommand.run(); await flutterCommand.run();
......
...@@ -130,7 +130,7 @@ baz=qux ...@@ -130,7 +130,7 @@ baz=qux
test('fires at start', () async { test('fires at start', () async {
bool called = false; bool called = false;
poller = new Poller(() { poller = new Poller(() async {
called = true; called = true;
}, const Duration(seconds: 1)); }, const Duration(seconds: 1));
expect(called, false); expect(called, false);
...@@ -141,7 +141,7 @@ baz=qux ...@@ -141,7 +141,7 @@ baz=qux
test('runs periodically', () async { test('runs periodically', () async {
// Ensure we get the first (no-delay) callback, and one of the periodic callbacks. // Ensure we get the first (no-delay) callback, and one of the periodic callbacks.
int callCount = 0; int callCount = 0;
poller = new Poller(() { poller = new Poller(() async {
callCount++; callCount++;
}, new Duration(milliseconds: kShortDelay.inMilliseconds ~/ 2)); }, new Duration(milliseconds: kShortDelay.inMilliseconds ~/ 2));
expect(callCount, 0); expect(callCount, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment