checkPermissions method
实现 FlutterBluetoothPluginPlatform.checkPermissions。
Web Bluetooth 没有全局预授权;已授权过设备时返回 granted,否则返回 notDetermined。
Implementation
@override
Future<Map<String, BluetoothPermissionStatus>> checkPermissions() async {
if (!_isWebBluetoothSupported) {
return const <String, BluetoothPermissionStatus>{
'bluetooth': BluetoothPermissionStatus.notApplicable,
};
}
final devices = await _authorizedDevices();
return <String, BluetoothPermissionStatus>{
'bluetooth': devices.isEmpty
? BluetoothPermissionStatus.notDetermined
: BluetoothPermissionStatus.granted,
};
}