Unverified Commit d7d64265 authored by Tianguang's avatar Tianguang Committed by GitHub

Add asserts requiring BoxConstraints' parameters to be non-null (#48295)

parent 5df63738
......@@ -90,7 +90,10 @@ class BoxConstraints extends Constraints {
this.maxWidth = double.infinity,
this.minHeight = 0.0,
this.maxHeight = double.infinity,
});
}) : assert (minWidth != null),
assert (maxWidth != null),
assert (minHeight != null),
assert (maxHeight != null);
/// Creates box constraints that is respected only by the given size.
BoxConstraints.tight(Size size)
......
......@@ -1007,6 +1007,13 @@ void main() {
expect(innerConstrained.localToGlobal(Offset.zero, ancestor: outerConstrained).dy, 25.0);
});
});
test('BoxConstraints parameters should be non-null', () {
expect(() => BoxConstraints(minWidth: null), throwsAssertionError);
expect(() => BoxConstraints(maxWidth: null), throwsAssertionError);
expect(() => BoxConstraints(minHeight: null), throwsAssertionError);
expect(() => BoxConstraints(maxHeight: null), throwsAssertionError);
});
}
class _DummyHitTestTarget implements HitTestTarget {
......
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