startscan method

Future<void> startscan()

Implementation

Future<void> startscan() async {
  if (!isInitialized) {
    log("Init");
    await init();
  }
  if (!isInitialized) {
    throw Exception(
      'WindowBluetoothManager is not initialized. Try starting the scan again',
    );
  }
  List<Printer> devices = [];
  WinBle.startScanning();
  subscription = WinBle.scanStream.listen((device) async {
    log(device.name);
    devices.add(Printer(
      address: device.address,
      name: device.name,
      connectionType: ConnectionType.BLE,
      isConnected: await WinBle.isPaired(device.address),
      // isConnected: false,
    ));
  });
}