# toMap method

1. @override

Map <String, dynamic> toMap ()
override

转换成可以序列化的map

## Implementation

    @override
    Map<String, dynamic> toMap() {
      final Map<String, dynamic> json = <String, dynamic>{};

      void addIfPresent(String fieldName, dynamic value) {
        if (value != null) {
          json[fieldName] = value;
        }
      }

      addIfPresent('id', id);
      if (points != null) {
        json['points'] = _pointsToJson();
      }
      addIfPresent('strokeWidth', strokeWidth);
      addIfPresent('strokeColor', strokeColor.value);
      addIfPresent('fillColor', fillColor.value);
      addIfPresent('visible', visible);
      addIfPresent('joinType', joinType.index);
      return json;
    }