getConnectMessage method Null safety

MqttConnectMessage getConnectMessage(
  1. String? username,
  2. String? password

Gets a pre-configured connect message if one has not been supplied by the user. Returns an MqttConnectMessage that can be used to connect to a message broker if the user has not set one.


MqttConnectMessage getConnectMessage(String? username, String? password) =>
    connectionMessage ??= MqttConnectMessage()
        // Explicitly set the will flag
        .authenticateAs(username, password)