Remove redundant empty table check from computeMaxIntrinsicHeight The check in computeMaxIntrinsicHeight was redundant since the method delegates to getMinIntrinsicHeight(), which eventually calls computeMinIntrinsicHeight() where the same check already exists. This simplifies the code while maintaining the same functionality. The checks in computeMinIntrinsicWidth, computeMaxIntrinsicWidth, and computeMinIntrinsicHeight remain as they either prevent division by zero or serve as performance optimizations for direct computations.
diff --git a/packages/flutter/lib/src/rendering/table.dart b/packages/flutter/lib/src/rendering/table.dart index 03626d0..5d77032 100644 --- a/packages/flutter/lib/src/rendering/table.dart +++ b/packages/flutter/lib/src/rendering/table.dart
@@ -1013,10 +1013,6 @@ @override double computeMaxIntrinsicHeight(double width) { - assert(_children.length == rows * columns); - if (rows * columns == 0) { - return 0.0; - } return getMinIntrinsicHeight(width); }
diff --git a/packages/flutter/test/rendering/table_test.dart b/packages/flutter/test/rendering/table_test.dart index fa52a66..6f127df 100644 --- a/packages/flutter/test/rendering/table_test.dart +++ b/packages/flutter/test/rendering/table_test.dart
@@ -405,7 +405,6 @@ test('Empty table intrinsic dimensions should not crash', () { // Test that empty tables (0 rows x 0 columns) don't cause division by zero // when intrinsic size methods are called with non-zero constraints. - // See: https://github.com/flutter/flutter/issues/XXXXX final RenderTable table = RenderTable(textDirection: TextDirection.ltr); // Verify table is empty