Closed trtiger4520 closed 3 months ago
I created the MqttSubscription object and subscribed and then calling unsubscribeSubscription(MqttSubscription subscription) threw an error message:
MqttSubscription
unsubscribeSubscription(MqttSubscription subscription)
I/flutter (14525): ----------------FIREBASE CRASHLYTICS---------------- I/flutter (14525): Null check operator used on a null value I/flutter (14525): I/flutter (14525): #0 MqttSubscriptionManager.unsubscribeSubscription (package:mqtt5_client/src/mqtt_subscription_manager.dart:240:56) I/flutter (14525): #1 MqttClient.unsubscribeSubscription (package:mqtt5_client/src/mqtt_client.dart:384:27) I/flutter (14525): #2 _MqServiceImpl._subscribe.<anonymous closure> (package:ltcsvc_driver/service/mqtt_service.dart:238:14) I/flutter (14525): #3 new MqSubscription.<anonymous closure> (package:ltcsvc_driver/service/mqtt_service.dart:281:17) I/flutter (14525): #4 _StreamController._recordCancel (dart:async/stream_controller.dart:732:38) I/flutter (14525): #5 _ControllerSubscription._onCancel (dart:async/stream_controller.dart:859:24) I/flutter (14525): #6 _BufferingStreamSubscription._cancel (dart:async/stream_impl.dart:252:21) I/flutter (14525): #7 _BufferingStreamSubscription._sendDone (dart:async/stream_impl.dart:396:5) I/flutter (14525): #8 _DelayedDone.perform (dart:async/stream_impl.dart:534:14) I/flutter (14525): #9 _PendingEvents.handleNext (dart:async/stream_impl.dart:620:11) I/flutter (14525): #10 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:591:7) I/flutter (14525): #11 _microtaskLoop (dart:async I/flutter (14525): ----------------------------------------------------
After a brief inspection, I found that the MqttSubscription property userProperties is nullable.
userProperties
https://github.com/shamblett/mqtt5_client/blob/0a8bf26efbc70aee00a00b3e4477ff5b57a8610c/lib/src/mqtt_subscription.dart#L49
https://github.com/shamblett/mqtt5_client/blob/0a8bf26efbc70aee00a00b3e4477ff5b57a8610c/lib/src/mqtt_subscription_manager.dart#L240
Ok thanks I'll have a look at this.
Fixed, package re published at version 4.2.3
great! thank you.
I created the
MqttSubscription
object and subscribed and then callingunsubscribeSubscription(MqttSubscription subscription)
threw an error message:After a brief inspection, I found that the
MqttSubscription
propertyuserProperties
is nullable.https://github.com/shamblett/mqtt5_client/blob/0a8bf26efbc70aee00a00b3e4477ff5b57a8610c/lib/src/mqtt_subscription.dart#L49
https://github.com/shamblett/mqtt5_client/blob/0a8bf26efbc70aee00a00b3e4477ff5b57a8610c/lib/src/mqtt_subscription_manager.dart#L240