Unverified Commit d227788a authored by Konstantin Scheglov's avatar Konstantin Scheglov Committed by GitHub

Move assert(s) that reference 'this' to the constructor bodies. (#66914)

parent 5f76bfb4
...@@ -349,8 +349,9 @@ class CupertinoPageRoute<T> extends PageRoute<T> with CupertinoRouteTransitionMi ...@@ -349,8 +349,9 @@ class CupertinoPageRoute<T> extends PageRoute<T> with CupertinoRouteTransitionMi
}) : assert(builder != null), }) : assert(builder != null),
assert(maintainState != null), assert(maintainState != null),
assert(fullscreenDialog != null), assert(fullscreenDialog != null),
assert(opaque), super(settings: settings, fullscreenDialog: fullscreenDialog) {
super(settings: settings, fullscreenDialog: fullscreenDialog); assert(opaque);
}
/// Builds the primary contents of the route. /// Builds the primary contents of the route.
final WidgetBuilder builder; final WidgetBuilder builder;
...@@ -376,8 +377,9 @@ class _PageBasedCupertinoPageRoute<T> extends PageRoute<T> with CupertinoRouteTr ...@@ -376,8 +377,9 @@ class _PageBasedCupertinoPageRoute<T> extends PageRoute<T> with CupertinoRouteTr
_PageBasedCupertinoPageRoute({ _PageBasedCupertinoPageRoute({
required CupertinoPage<T> page, required CupertinoPage<T> page,
}) : assert(page != null), }) : assert(page != null),
assert(opaque), super(settings: page) {
super(settings: page); assert(opaque);
}
CupertinoPage<T> get _page => settings as CupertinoPage<T>; CupertinoPage<T> get _page => settings as CupertinoPage<T>;
......
...@@ -45,8 +45,9 @@ class MaterialPageRoute<T> extends PageRoute<T> with MaterialRouteTransitionMixi ...@@ -45,8 +45,9 @@ class MaterialPageRoute<T> extends PageRoute<T> with MaterialRouteTransitionMixi
}) : assert(builder != null), }) : assert(builder != null),
assert(maintainState != null), assert(maintainState != null),
assert(fullscreenDialog != null), assert(fullscreenDialog != null),
assert(opaque), super(settings: settings, fullscreenDialog: fullscreenDialog) {
super(settings: settings, fullscreenDialog: fullscreenDialog); assert(opaque);
}
/// Builds the primary contents of the route. /// Builds the primary contents of the route.
final WidgetBuilder builder; final WidgetBuilder builder;
...@@ -186,8 +187,9 @@ class _PageBasedMaterialPageRoute<T> extends PageRoute<T> with MaterialRouteTran ...@@ -186,8 +187,9 @@ class _PageBasedMaterialPageRoute<T> extends PageRoute<T> with MaterialRouteTran
_PageBasedMaterialPageRoute({ _PageBasedMaterialPageRoute({
@required MaterialPage<T> page, @required MaterialPage<T> page,
}) : assert(page != null), }) : assert(page != null),
assert(opaque), super(settings: page) {
super(settings: page); assert(opaque);
}
MaterialPage<T> get _page => settings as MaterialPage<T>; MaterialPage<T> get _page => settings as MaterialPage<T>;
......
...@@ -1918,6 +1918,7 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget { ...@@ -1918,6 +1918,7 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget {
/// objects. /// objects.
MultiChildRenderObjectWidget({ Key? key, this.children = const <Widget>[] }) MultiChildRenderObjectWidget({ Key? key, this.children = const <Widget>[] })
: assert(children != null), : assert(children != null),
super(key: key) {
assert(() { assert(() {
for (int index = 0; index < children.length; index++) { for (int index = 0; index < children.length; index++) {
// TODO(a14n): remove this check to have a lot more const widget // TODO(a14n): remove this check to have a lot more const widget
...@@ -1929,8 +1930,8 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget { ...@@ -1929,8 +1930,8 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget {
} }
} }
return true; return true;
}()), // https://github.com/dart-lang/sdk/issues/29276 }()); // https://github.com/dart-lang/sdk/issues/29276
super(key: key); }
/// The widgets below this widget in the tree. /// The widgets below this widget in the tree.
/// ///
......
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