exportToJson method
Implementation
Map<String, dynamic> exportToJson() {
if (_currentTemplate == null) return {};
// Get the standard JSON representation
final json = _currentTemplate!.toJson();
// Check if canvas has backgroundImage and it's Base64
final backgroundImage = _currentTemplate!.canvas.backgroundImage;
if (backgroundImage != null && backgroundImage.startsWith('data:')) {
// Get canvas JSON and convert to Map if needed
final canvasJson = _currentTemplate!.canvas.toJson();
final modifiedCanvas = Map<String, dynamic>.from(canvasJson);
// Replace Base64 with placeholder URL
modifiedCanvas['backgroundImage'] = 'Your Exact Blank Template URL HERE';
// Update the JSON with modified canvas
json['canvas'] = modifiedCanvas;
}
return json;
}