toMetadataJson method
Implementation
Map<String, Object?> toMetadataJson() {
return {
'type': type.name,
'stage': stage.name,
'message': message,
'timestamp': timestamp.toUtc().toIso8601String(),
if (completed != null) 'completed': completed,
if (total != null) 'total': total,
if (fraction != null) 'fraction': fraction,
if (status != null) 'status': status!.name,
if (format != null) 'format': format!.name,
if (filename != null) 'filename': filename,
if (metadata.isNotEmpty) 'metadata': metadata,
};
}