encodeBoxConstraints static method
Encodes the given value
into a JSON compatible map. This produces a Map
in the following format:
{
"maxHeight": "<double>",
"maxWidth": "<double>",
"minHeight": "<double>",
"minWidth": "<double>"
}
A value
of null
will result in null
being returned.
Implementation
static Map<String, dynamic>? encodeBoxConstraints(BoxConstraints? value) {
Map<String, dynamic>? result;
if (value != null) {
result = <String, dynamic>{
'maxHeight':
value.maxHeight == double.infinity ? null : value.maxHeight,
'maxWidth': value.maxWidth == double.infinity ? null : value.maxWidth,
'minHeight': value.minHeight,
'minWidth': value.minWidth,
};
}
return _stripDynamicNull(result);
}