Closed LorenzSchueler closed 1 year ago
Why do you want to do nothing in connectToDevice
if the permissions request fails? The caller wouldn't know anything went wrong. The native call at least throws an exception which is what the dart code should also be doing if we aren't making the native call, but then we might as well just call the native method anyways.
You are right about that. I was honestly more interested in getting to know whether permissions have been granted.
I also thought about returning the permission status from requestPermissions
directly, but because the are multiple permissions requested I'm not sure on how to combine the status from those requests. Therefor I just went with the bool
.
Should I revert the changes to connectToDevice
and are you fine with those to requestPermissions
?
Furthermore is there any advantage in requesting bluetoothConnect
if bluetoothScan
is not granted? If we can't discover devices we can't connect to them anyway. One option would be to check if bluetoothScan
is granted. If so, request bluetoothConnect
and return its PermissionStatus
. If not return the PermissionStatus
from bluetoothScan
. The only question is what to return if we are not an Android >23? Do we simply return null
(requires return type to be Future<PermissionStatus?>
)?
You can connect to devices without scanning
requestPermissions
.connectToDevice
only ifrequestPermissions
isfalse
or permissions have been granted.