Message.fromJson constructor Null safety

Message.fromJson(
  1. List parts
)

Given a parsed JSON coming from the backend, yield a Message instance.

Implementation

factory Message.fromJson(List<dynamic> parts) {
  _logger.finest('Message decoded from $parts');
  return Message(
    joinRef: parts[0],
    ref: parts[1],
    topic: parts[2],
    event: PhoenixChannelEvent.custom(parts[3]),
    payload: parts[4],
  );
}