# toMap method

1. @override

Map <String, dynamic> toMap ()
override

## 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);
      addIfPresent('alpha', alpha);
      addIfPresent('anchor', _offsetToJson(anchor));
      addIfPresent('clickable', clickable);
      addIfPresent('draggable', draggable);
      addIfPresent('icon', icon?.toMap());
      addIfPresent('infoWindowEnable', infoWindowEnable);
      addIfPresent('infoWindow', infoWindow?._toMap());
      addIfPresent('position', position?.toJson());
      addIfPresent('rotation', rotation);
      addIfPresent('visible', visible);
      addIfPresent('zIndex', zIndex);
      return json;
    }