connect method

void connect([
  1. String? username,
  2. String? password
])

Implementation

void connect([String? username, String? password]) async {
  assert(client != null);
  try {
    if (_allowPrintLog) print('MQTT::Mosquitto start client connecting....');

    await client!.connect(username, password);
  } on Exception catch (e) {
    if (_allowPrintLog) print('MQTT::client exception - $e');
    disconnect();
  }
}