state property

Gets the current state of the Bluetooth module

Implementation

Stream<BluetoothState> get state async* {
  yield await _channel
      .invokeMethod('state')
      .then((buffer) => new protos.BluetoothState.fromBuffer(buffer))
      .then((s) => BluetoothState.values[s.state.value]);

  yield* _stateChannel
      .receiveBroadcastStream()
      .map((buffer) => new protos.BluetoothState.fromBuffer(buffer))
      .map((s) => BluetoothState.values[s.state.value]);
}