encodeSize static method

Map<String, dynamic>? encodeSize(
  1. Size? value
)

Encodes the given value to a JSON compatible Map.

This returns the JSON representation to follow the structure:

{
  "height": <double>,
  "width": <double>
}

Implementation

static Map<String, dynamic>? encodeSize(Size? value) {
  Map<String, dynamic>? result;

  if (value != null) {
    result = {
      'height': value.height,
      'width': value.width,
    };
  }

  return _stripNull(result);
}