toMap method
将对象转换为可序列化的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);
json['points'] = _pointsToJson();
addIfPresent('width', width);
addIfPresent('visible', visible);
addIfPresent('geodesic', geodesic);
addIfPresent('alpha', alpha);
addIfPresent('dashLineType', dashLineType.index);
addIfPresent('capType', capType.index);
addIfPresent('joinType', joinType.index);
addIfPresent('customTexture', customTexture?.toMap());
addIfPresent('color', color.value);
return json;
}