toJson method
Converts a Size object to a JSON map, or null if size is null.
Returns a map with 'width' and 'height' keys containing the size's dimensions.
Example:
final converter = SizeConverter();
final json = converter.toJson(Size(100.5, 50.3));
// json == {'width': 100.5, 'height': 50.3}
Implementation
@override
Map<String, dynamic>? toJson(Size? size) {
if (size == null) return null;
return {'width': size.width, 'height': size.height};
}