toMap method

Map<String, dynamic> toMap()

转换成可以序列化的map

Implementation

Map<String, dynamic> toMap() {
  final Map<String, dynamic> updateMap = <String, dynamic>{};

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

  addIfNonNull('polygonsToAdd', serializeOverlaySet(polygonsToAdd!));
  addIfNonNull('polygonsToChange', serializeOverlaySet(polygonsToChange!));
  addIfNonNull('polygonIdsToRemove', polygonIdsToRemove?.toList());

  return updateMap;
}