BridgeMessage.fromJson constructor
Deserialize from JSON map.
Implementation
factory BridgeMessage.fromJson(Map<String, dynamic> json) {
final type = BridgeMessageType.fromWireName(json['type'] as String);
if (type == null) {
throw FormatException('Unknown bridge message type: ${json['type']}');
}
return BridgeMessage(
id: json['id'] as String?,
type: type,
payload: (json['payload'] as Map<String, dynamic>?) ?? {},
timestamp: json['timestamp'] != null
? DateTime.parse(json['timestamp'] as String)
: null,
correlationId: json['correlationId'] as String?,
);
}