encodeRect static method

Map<String, dynamic>? encodeRect(
  1. Rect? value
)

Encodes the given value to a JSON compatible Map.

This returns the JSON representation to follow the structure:

{
  "bottom": "<double>",
  "left": "<double>",
  "right": "<double>",
  "top": "<double>",
  "type": "ltrb"
}

Implementation

static Map<String, dynamic>? encodeRect(Rect? value) {
  Map<String, dynamic>? result;

  if (value != null) {
    result = {
      'bottom': value.bottom,
      'left': value.left,
      'right': value.right,
      'top': value.top,
      'type': 'ltrb',
    };
  }

  return _stripDynamicNull(result);
}