Fix various strong mode issues. (#14284)

This commit is contained in:
Vyacheslav Egorov
2018-01-31 08:21:32 +01:00
committed by GitHub
parent 122796137b
commit 340d9e00cf
7 changed files with 20 additions and 6 deletions

View File

@@ -463,7 +463,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
));
assert(_parentZone != null);
assert(_pendingExceptionDetails != null, 'A test overrode FlutterError.onError but either failed to return it to its original state, or had unexpected additional errors that it could not handle. Typically, this is caused by using expect() before restoring FlutterError.onError.');
_parentZone.run<Null>(_testCompletionHandler);
_parentZone.run<void>(_testCompletionHandler);
}
);
_parentZone = Zone.current;

View File

@@ -132,8 +132,12 @@ class WidgetController {
Iterable<State> get allStates {
TestAsyncUtils.guardSync();
return allElements
// TODO(vegorov) replace with Iterable.whereType, when it is available. https://github.com/dart-lang/sdk/issues/27827
.where((Element element) => element is StatefulElement)
.map((StatefulElement element) => element.state); // ignore: STRONG_MODE_INVALID_CAST_FUNCTION_EXPR, https://github.com/dart-lang/sdk/issues/27827
.map((Element element) {
final StatefulElement statefulElement = element;
return statefulElement.state;
});
}
/// The matching state in the widget tree.