toJson method
Implementation
Map<String, dynamic> toJson() => {
'id': id,
'type': type.name,
if (stateKey != null) 'stateKey': stateKey,
if (oldValue != null) 'oldValue': _serializeValue(oldValue),
if (newValue != null) 'newValue': _serializeValue(newValue),
if (userId != null) 'userId': userId,
if (userEmail != null) 'userEmail': userEmail,
'timestamp': timestamp.toIso8601String(),
if (metadata != null) 'metadata': metadata,
if (previousHash != null) 'previousHash': previousHash,
if (hash != null) 'hash': hash,
};