watchForClose method
Wait for the connection to close and then reset advertising variables.
Implementation
Future<void> watchForClose() async {
if (!reconnectOnClose) {
await ros.statusStream.firstWhere((s) => s == Status.closed);
advertiseId = null;
}
}