push method Null safety

Push push(
  1. ChannelEvents event,
  2. Map<String, String> payload,
  3. {Duration? timeout}
)

Implementation

Push push(
  ChannelEvents event,
  Map<String, String> payload, {
  Duration? timeout,
}) {
  if (!_joinedOnce) {
    throw "tried to push '${event.eventName()}' to '$topic' before joining. Use channel.subscribe() before pushing events";
  }
  final pushEvent = Push(this, event, payload, timeout ?? _timeout);
  if (canPush()) {
    pushEvent.send();
  } else {
    pushEvent.startTimeout();
    _pushBuffer.add(pushEvent);
  }

  return pushEvent;
}