toJson method
Implementation
Map<String, Object?> toJson() => {
// Guarded for the same reason as the constraints, though a laid-out box
// should never be non-finite: an encoder that throws takes down the whole
// read, so nothing that reaches it is left to chance.
'x': _finite(x),
'y': _finite(y),
'width': _finite(width),
'height': _finite(height),
if (constraints != null) 'constraints': constraints!.toJson(),
if (isRepaintBoundary) 'repaintBoundary': true,
if (flex != null) 'flex': flex!.toJson(),
if (flexFactor != null) 'flexFactor': flexFactor,
if (flexFit != null) 'flexFit': flexFit,
};