SessionEndMessage.fromMap constructor
SessionEndMessage.fromMap(
- Map<String, dynamic> map
)
Implementation
factory SessionEndMessage.fromMap(Map<String, dynamic> map) =>
SessionEndMessage(
fromNodeUId: map['fromNodeUId'],
// An unrecognised reason still ends the session — the reason is
// informational, and refusing to decode would leave the node hanging.
reason:
SessionEndReason.values
.where((r) => r.name == map['reason'])
.firstOrNull ??
SessionEndReason.coordinatorLeft,
targetNodeUId: map['targetNodeUId'],
timestamp: DateTime.parse(map['timestamp']),
messageId: map['messageId'],
parentMessageId: map['parentMessageId'],
metadata: Map<String, dynamic>.from(map['metadata'] ?? {}),
);