toMap method

Map<String, dynamic> toMap()

将对象装换为可序列化的对象

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('polylinesToAdd', serializeOverlaySet(polylinesToAdd!));
  addIfNonNull('polylinesToChange', serializeOverlaySet(polylinesToChange!));
  addIfNonNull('polylineIdsToRemove', polylineIdsToRemove?.toList());

  return updateMap;
}