doAutoReconnect method Null safety

void doAutoReconnect(
  1. {bool force = false}

Auto reconnect method, used to invoke a manual auto reconnect sequence. If autoReconnect is not set this method does nothing. If the client is not disconnected this method will have no effect unless the force parameter is set to true, otherwise auto reconnect will try indefinitely to reconnect to the broker.


void doAutoReconnect({bool force = false}) {
  if (!autoReconnect) {
        'MqttClient::doAutoReconnect - auto reconnect is not set, exiting');

  if (connectionStatus!.state != MqttConnectionState.connected || force) {
    // Fire a manual auto reconnect request.
    final wasConnected =
        connectionStatus!.state == MqttConnectionState.connected;
        .fire(AutoReconnect(userRequested: true, wasConnected: wasConnected));