diff --git a/packages/flutter/lib/src/rendering/sliver.dart b/packages/flutter/lib/src/rendering/sliver.dart index 4fd7c4dcd3..5b4348a797 100644 --- a/packages/flutter/lib/src/rendering/sliver.dart +++ b/packages/flutter/lib/src/rendering/sliver.dart @@ -656,6 +656,8 @@ class SliverGeometry extends Diagnosticable { /// * [RenderViewport.cacheExtent] for a description of a viewport's cache area. final double cacheExtent; + static const double _epsilon = 1e-10; + /// Asserts that this geometry is internally consistent. /// /// Does nothing if asserts are disabled. Always returns true. @@ -686,7 +688,9 @@ class SliverGeometry extends Diagnosticable { ); } verify(maxPaintExtent != null, 'The "maxPaintExtent" is null.'); - if (maxPaintExtent < paintExtent) { + // If the paintExtent is slightly more than the maxPaintExtent, but the difference is still less + // than epsilon, we will not throw the assert below. + if (paintExtent - maxPaintExtent > _epsilon) { verify(false, 'The "maxPaintExtent" is less than the "paintExtent".\n' + _debugCompareFloats('maxPaintExtent', maxPaintExtent, 'paintExtent', paintExtent) +