connectionState property

Stream<BluetoothConnectionState> connectionState
override

The current connection state of our app to the device

Implementation

Stream<BluetoothConnectionState> get connectionState async* {
  await FlutterBluePlusWindows._initialize();

  final map = FlutterBluePlusWindows._connectionStream.latestValue;

  log('Connection State is started');

  if (map[_address] != null) {
    yield map[_address]!.isConnected;
  }

  await for (final event in WinBle.connectionStreamOf(_address)) {
    yield event.isConnected;
  }

  log('Connection State is closed');
}