Closed mis-kcn closed 1 year ago
Ok the lfile mosquito_bloc.dart isnt from this package so Im not sure what this is, you dont say what the failure is, Im guessing a null exception, on the event bus this is usually caused by the client being disconnected and closed.
Ill need a log to look any further.
Oops sorry about that, it wasn't with the mosquitto_bloc
that was my own bloc implementation of the whole thing.
Null check operator used on a null value
occurs at mqtt_client.dart
at the doAutoReconnect
function, at the clientEventBus!
line.
Any news on this? I have the problem as well... log from firebase
Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError
Bad state: Cannot add new events after calling close. Error thrown null.
_BroadcastStreamController.add (_BroadcastStreamController.java)
EventBus.fire (event_bus.dart:61)
MqttConnectionHandlerBase.autoReconnect (mqtt_client_mqtt_connection_handler_base.dart:155)
You've closed(disconnected) the client somehow before autoreconnect starts, do you have a full log of what happened before this point?
Nope, crashlytics show just this piece of error... We are sending our implementation of connect and the _onAutoReconnect function just verifies if our token is not null and do connect again... if you are available I can show the code...
Whatever you are doing you have closed the event bus, hence the bad state, this being picked up in auto reconnect, its not something it has done, its something it has found. Do you have an onDisconnected callback?
Yes, we have an onDisconnected callback, how can I simulate/force the autoReconnect?
You need to disconnect the broker, so kill the network connection, or the broker, or switch from GSM to wireless etc.
Code is failing at
mqtt_client.dart
Line 353 atclientEventBus!
.Error occurs at v.9.7.2, no clear MRE at the moment.