toMap method
Implementation
Map<String, dynamic> toMap() {
return {
'posX': posX,
'posY': posY,
'algorithm': algorithm.toString().split('.').last, // Convert enum to string
'value': value,
'width': width,
'height': height,
};
}