Map<String, Object?> toJson() { var x = this.x; var y = this.y; final json = <String, Object?>{}; if (x != null) { json[r'x'] = x; } if (y != null) { json[r'y'] = y; } return json; }