flex method Null safety

  1. @override
double? flex(
  1. Iterable<RenderBox> cells
)
override

The flex factor to apply to the cell if there is any room left over when laying out the table. The remaining space is distributed to any columns with flex in proportion to their flex value (higher values get more space).

The cells argument is an iterable that provides all the cells in the table for this column. Walking the cells is by definition O(N), so algorithms that do that should be considered expensive.

Implementation

@override
double? flex(Iterable<RenderBox> cells) {
  final double? aFlex = a.flex(cells);
  if (aFlex == null)
    return b.flex(cells);
  final double? bFlex = b.flex(cells);
  if (bFlex == null)
    return null;
  return math.min(aFlex, bFlex);
}