adapterState property
Stream<BluetoothAdapterState>
get
adapterState
Gets the current state of the Bluetooth module
Implementation
static Stream<BluetoothAdapterState> get adapterState async* {
// get current state if needed
if (_adapterStateNow == null) {
var result =
await _invokePlatform(() => FlutterBluePlusPlatform.instance.getAdapterState(BmBluetoothAdapterStateRequest()));
// update _adapterStateNow if it is still null after the await
_adapterStateNow ??= result.adapterState;
}
yield* FlutterBluePlusPlatform.instance.onAdapterStateChanged
.map((s) => _bmToAdapterState(s.adapterState))
.newStreamWithInitialValue(_bmToAdapterState(_adapterStateNow!));
}