debugAssertDoesMeetConstraints method

  1. @override
void debugAssertDoesMeetConstraints()

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.


void debugAssertDoesMeetConstraints() {
    informationCollector: () => <DiagnosticsNode>[
      describeForError('The RenderSliver that returned the offending geometry was'),
  assert(() {
    if (geometry!.paintOrigin + geometry!.paintExtent > constraints.remainingPaintExtent) {
      throw FlutterError.fromParts(<DiagnosticsNode>[
        ErrorSummary('SliverGeometry has a paintOffset that exceeds the remainingPaintExtent from the constraints.'),
        describeForError('The render object whose geometry violates the constraints is the following'),
          'remainingPaintExtent', constraints.remainingPaintExtent,
          'paintOrigin + paintExtent', geometry!.paintOrigin + geometry!.paintExtent,
          'The paintOrigin and paintExtent must cause the child sliver to paint '
          'within the viewport, and so cannot exceed the remainingPaintExtent.',
    return true;