pushEvent method Null safety

Push pushEvent(
  1. PhoenixChannelEvent event,
  2. Map<String, dynamic> payload,
  3. [Duration? newTimeout]
)

Push a message with a valid PhoenixChannelEvent name.

This variant is used internally for channel joining/leaving. Prefer using push instead.

Implementation

Push pushEvent(
  PhoenixChannelEvent event,
  Map<String, dynamic> payload, [
  Duration? newTimeout,
]) {
  assert(_joinedOnce);

  final pushEvent = Push(
    this,
    event: event,
    payload: () => payload,
    timeout: newTimeout ?? _timeout,
  );

  if (canPush) {
    pushEvent.send();
  } else {
    pushBuffer.add(pushEvent);
  }

  return pushEvent;
}