debugAssertDoesMeetConstraints method
- @override
override
Verify that the object's constraints are being met. Override this function in a subclass to verify that your state matches the constraints object. This function is only called in checked mode and only when needsLayout is false. If the constraints are not met, it should assert or throw an exception.
Implementation
@override
void debugAssertDoesMeetConstraints() {
assert(geometry.debugAssertIsValid(
informationCollector: (StringBuffer information) {
information.writeln('The RenderSliver that returned the offending geometry was:');
information.writeln(' ${toStringShallow(joiner: '\n ')}');
},
));
assert(() {
if (geometry.paintExtent > constraints.remainingPaintExtent) {
throw FlutterError(
'SliverGeometry has a paintOffset that exceeds the remainingPaintExtent from the constraints.\n'
'The render object whose geometry violates the constraints is the following:\n'
' ${toStringShallow(joiner: '\n ')}\n' +
_debugCompareFloats('remainingPaintExtent', constraints.remainingPaintExtent,
'paintExtent', geometry.paintExtent) +
'The paintExtent must cause the child sliver to paint within the viewport, and so '
'cannot exceed the remainingPaintExtent.'
);
}
return true;
}());
}