[X] I've looked at the README 'Common Problems' section
Have you checked this problem on the example app?
No
FlutterBluePlus Version
1.17.3
Flutter Version
3.10.6
What OS?
Android
OS Version
10
Bluetooth Module
Don't know
What is your problem?
When getting the bondedDevices, the platformName is always empty.
The debug logs are displaying the right platformName, but the returned objects have empty platformName.
This is because the bondedDevices method do not fill the _platformNames like connectedSystemDevices does.
Bellow a working code for bondedDevices:
/// Retrieve a list of bonded devices (Android only) static Future<List<BluetoothDevice>> get bondedDevices async { BmConnectedDevicesResponse response = await _invokeMethod('getBondedDevices') .then((args) => BmConnectedDevicesResponse.fromMap(args)); for (BmBluetoothDevice device in response.devices) { if (device.platformName != null) { _platformNames[DeviceIdentifier(device.remoteId)] = device.platformName!; } } return response.devices.map((d) => BluetoothDevice.fromProto(d)).toList(); }
Requirements
Have you checked this problem on the example app?
No
FlutterBluePlus Version
1.17.3
Flutter Version
3.10.6
What OS?
Android
OS Version
10
Bluetooth Module
Don't know
What is your problem?
When getting the bondedDevices, the platformName is always empty. The debug logs are displaying the right platformName, but the returned objects have empty platformName.
This is because the
bondedDevices
method do not fill the_platformNames
likeconnectedSystemDevices
does.Bellow a working code for bondedDevices:
/// Retrieve a list of bonded devices (Android only) static Future<List<BluetoothDevice>> get bondedDevices async { BmConnectedDevicesResponse response = await _invokeMethod('getBondedDevices') .then((args) => BmConnectedDevicesResponse.fromMap(args)); for (BmBluetoothDevice device in response.devices) { if (device.platformName != null) { _platformNames[DeviceIdentifier(device.remoteId)] = device.platformName!; } } return response.devices.map((d) => BluetoothDevice.fromProto(d)).toList(); }
Logs