Fix the type of RenderTable.get rowDecorations. (#151886)

This changes the return type from `List<Decoration>` to `List<Decoration?>`, matching the corresponding setter.
As such it is a breaking change.
I believe the current type is a *bug*, and this is the correct fix.

The underlying value has a nullable element type, and the setter accepts a list which can contain `null`, but the getter tries to create a list with non-nullable elements from the stored value.
Calling this getter while the list contains `null` will throw.

(If this fix is too simplistic, I'll file a bug for the issue instead.)
This commit is contained in:
Lasse R.H. Nielsen
2024-07-24 00:14:13 +02:00
committed by GitHub
parent d436acf808
commit 6574484fc2

View File

@@ -535,7 +535,7 @@ class RenderTable extends RenderBox {
/// Row decorations fill the horizontal and vertical extent of each row in
/// the table, unlike decorations for individual cells, which might not fill
/// either.
List<Decoration> get rowDecorations => List<Decoration>.unmodifiable(_rowDecorations ?? const <Decoration>[]);
List<Decoration?> get rowDecorations => List<Decoration?>.unmodifiable(_rowDecorations ?? const <Decoration>[]);
// _rowDecorations and _rowDecorationPainters need to be in sync. They have to
// either both be null or have same length.
List<Decoration?>? _rowDecorations;