toJson method
Implementation
Map toJson(){
Map result = {};
if (x != null) result.addAll({"x": x});
if (y != null) result.addAll({"y": y});
if (width != null) result.addAll({"width": width});
if (height != null) result.addAll({"height": height});
return result;
}