dotintent / FlutterBleLib

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

Error calling descriptorsForCharacteristic when there is no descriptor for that characteristic #492

Open pagind92 opened 4 years ago

pagind92 commented 4 years ago

Hi, i am testing FlutterBleLib (2.2.5) using Android and iOS environment and a Ble device. I found that the peripheral method descriptorsForCharacteristic throws error with iOS environment if there is no descriptor for the given characteristic. The error is caused by the method descriptorsForPeripheral of file discovery_mixin.dart, in particular when the JSON string must be mapped. If there is no descriptor, the JSON string returned by Android invoke method is:

{"descriptors":[]}

The JSON string returned by iOS invoke method is:

[

]

So the lib cannot map to Map<String, dynamic>. I confirm that the method descriptorsForPeripheral works well if there is a descriptor with both environments.

mikolak commented 4 years ago

Thanks! I'll fix that when I have the time.