triggerError method Null safety

void triggerError(
  1. PhoenixException error
)

Trigger an error on this channel.

Implementation

void triggerError(PhoenixException error) {
  _logger.fine('Receiving error on channel', error);
  if (!statesIgnoringErrors.contains(_state)) {
    if (error.message != null) {
      trigger(error.message!);
    }

    _logger.warning('Got error on channel', error);

    for (final waiter in _waiters.values) {
      waiter.completeError(error);
    }
    _waiters.clear();

    final prevState = _state;
    _state = PhoenixChannelState.errored;
    if (prevState == PhoenixChannelState.joining) {
      _joinPush.reset();
    }

    if (socket.isConnected) {
      _startRejoinTimer();
    }
  }
}