width property

double? width
getter/setter pair

Size along each axis, three-valued in one field:

  • null — hug: as big as the content needs.
  • a finite number — fixed.
  • double.infinity — fill: as much as the parent gives.

The sentinel is Flutter's own vocabulary rather than an invention: Container(width: double.infinity) already means this, so the value reads the way it behaves and every reader that only passes it through keeps working. It is not JSON, though — jsonEncode refuses a non-finite double — so both the wire and the file spell it out; see sizeToWire.

Fill along the parent's MAIN axis needs that parent to be bounded on it: a column that hugs its height has no leftover to hand out. The renderer honours what it can and the editor is where the contradiction has to be shown, not hidden.

Implementation

double? width;