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 _invokeMethod('getAdapterState');
var value = BmBluetoothAdapterState.fromMap(result).adapterState;
// update _adapterStateNow if it is still null after the await
_adapterStateNow ??= value;
}
yield* FlutterBluePlus._methodStream.stream
.where((m) => m.method == "OnAdapterStateChanged")
.map((m) => m.arguments)
.map((args) => BmBluetoothAdapterState.fromMap(args))
.map((s) => _bmToAdapterState(s.adapterState))
.newStreamWithInitialValue(_bmToAdapterState(_adapterStateNow!));
}