getStateStream method

Stream<BluetoothState> getStateStream({
  1. int timer = 1000,
})

Emits the current BluetoothState every time the adapter state changes.

The timer parameter is kept for backwards compatibility and is ignored.

Implementation

Stream<BluetoothState> getStateStream({int timer = 1000}) {
  return _events.receiveBroadcastStream().map((event) {
    return enumFromString(BluetoothState.values, event as String?) ??
        BluetoothState.uknow;
  });
}