sizeToWire function

Object? sizeToWire(
  1. double? size
)

A size on its way out to the wire or a file.

Fill is double.infinity in the model, and jsonEncode refuses a non-finite double, so it travels as a word. Hug is still null and a fixed size is still its number.

Implementation

Object? sizeToWire(double? size) =>
    size != null && size.isInfinite ? 'fill' : size;