MQTTService class

MQTT 服务

Properties

connected bool
是否连接
no setter
hashCode int
The hash code for this object.
no setterinherited
isInitialized bool
是否已初始化
no setter
mqttClient ↔ MqttServerClient?
MQTT 客户端
getter/setter pair
qos ↔ MqttQos
消息质量
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

connect([String? username, String? password]) Future<void>
连接
disconnect() → void
断开连接
initMQTT([String? username, String? password]) Future<void>
重连次数 初始化
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
on<S, E>(String topic, {SuccessCallback<S>? onSuccess, ErrorCallback<E>? onError}) → void
监听
publish<T>({required String topic, required String message}) Future<T>
消息发布
subscribe(String topic, {MqttQos? qosLevel}) → void
订阅主题
toString() String
A string representation of this object.
inherited
unsubscribe(MqttSubscription topic) → void
取消订阅

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance MQTTService
单例
no setter