dotintent / FlutterBleLib

Bluetooth Low Energy library for Flutter with support for simulating peripherals
Apache License 2.0
535 stars 197 forks source link

[Flutter: ScanResult library peripheral scan return Null] #522

Closed Rayen-cherni closed 3 years ago

Rayen-cherni commented 3 years ago

I have a flutter application where I need to use Bluetooth Low Energy using this Library and I need to check the name of other devices: Library : https://pub.dev/packages/flutter_ble_lib Code : ... ScanResult scanResult ... print("Scanned Peripheral ${scanResult.peripheral.name}") Result : Scanned Peripheral null

mikolak commented 3 years ago

Both local name and name are nullable, they may not exist on a peripheral.

Rayen-cherni commented 3 years ago

So how can i get device's names ?

mikolak commented 3 years ago

You check those two fields. If your device is certain to have a name, it will be on one of those. If the device doesn't have a name, then it doesn't have a name, nothing you could do about it.