toJson method

  1. @override
Object toJson()
override

Converts this object to something serializable in JSON.

Implementation

@override
Object toJson() {
  final Map<String, Object> json = <String, Object>{};

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

  addIfPresent('markerId', markerId.value);
  addIfPresent('alpha', alpha);
  addIfPresent('anchor', _offsetToJson(anchor));
  addIfPresent('consumeTapEvents', consumeTapEvents);
  addIfPresent('draggable', draggable);
  addIfPresent('flat', flat);
  addIfPresent('icon', icon.toJson());
  addIfPresent('infoWindow', infoWindow._toJson());
  addIfPresent('position', position.toJson());
  addIfPresent('rotation', rotation);
  addIfPresent('visible', visible);
  addIfPresent('zIndex', zIndex);
  addIfPresent('clusterManagerId', clusterManagerId?.value);
  return json;
}