adapterStateChanges method
Adapter state transitions. Broadcast; emits the current state on listen.
Implementation
@override
Stream<BluetoothAdapterState> adapterStateChanges() {
late StreamController<BluetoothAdapterState> proxy;
StreamSubscription<BluetoothAdapterState>? sub;
proxy = StreamController<BluetoothAdapterState>.broadcast(
onListen: () {
proxy.add(_adapterState);
sub = _adapterController.stream.listen(proxy.add);
},
onCancel: () async => sub?.cancel(),
);
return proxy.stream;
}