Add asserts requiring BoxConstraints' parameters to be non-null (#48295)
This commit is contained in:
parent
5df63738f8
commit
d7d642653a
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user