Commit 9b5d1fbe authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Provide more widget const constructors. (#9247)

Still many more to go.
parent 93b90362
......@@ -14,7 +14,9 @@ class FractionalOffset {
/// Creates a fractional offset.
///
/// The [dx] and [dy] arguments must not be null.
const FractionalOffset(this.dx, this.dy);
const FractionalOffset(this.dx, this.dy)
: assert(dx != null),
assert(dy != null);
/// The distance fraction in the horizontal direction.
///
......
......@@ -167,19 +167,18 @@ class Banner extends StatelessWidget {
/// Creates a banner.
///
/// The [message] and [location] arguments must not be null.
Banner({
const Banner({
Key key,
this.child,
@required this.message,
@required this.location,
this.color: _kColor,
this.textStyle: _kTextStyle,
}) : super(key: key) {
assert(message != null);
assert(location != null);
assert(color != null);
assert(textStyle != null);
}
}) : assert(message != null),
assert(location != null),
assert(color != null),
assert(textStyle != null),
super(key: key);
/// The widget to show behind the banner.
final Widget child;
......@@ -215,7 +214,7 @@ class Banner extends StatelessWidget {
/// Does nothing in release mode.
class CheckedModeBanner extends StatelessWidget {
/// Creates a checked mode banner.
CheckedModeBanner({
const CheckedModeBanner({
Key key,
@required this.child
}) : super(key: key);
......
This diff is collapsed.
......@@ -1339,9 +1339,9 @@ abstract class MultiChildRenderObjectWidget extends RenderObjectWidget {
/// The [children] argument must not be null and must not contain any null
/// objects.
MultiChildRenderObjectWidget({ Key key, this.children: const <Widget>[] })
: super(key: key) {
assert(children != null);
assert(!children.any((Widget child) => child == null));
: assert(children != null),
super(key: key) {
assert(!children.any((Widget child) => child == null)); // https://github.com/dart-lang/sdk/issues/29276
}
/// 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