requestBluetoothPermissions static method

Future<BluetoothPermissionStatus> requestBluetoothPermissions(
  1. MethodChannel channel
)

Requests Bluetooth permissions from the user.

This method communicates with the native platform code to request Bluetooth permissions. It returns one of the values from the BluetoothPermissionStatus enumeration.

  • BluetoothPermissionStatus.GRANTED: Permission is granted.
  • BluetoothPermissionStatus.DENIED: Permission is denied.

Returns a Future containing the BluetoothPermissionStatus representing whether permission was granted or not.

Implementation

static Future<BluetoothPermissionStatus> requestBluetoothPermissions(
  MethodChannel channel,
) async {
  final String permissionStatusString =
      await channel.invokeMethod('requestBluetoothPermissions') as String;
  return BluetoothPermissionStatus.values
      .firstWhere((status) => status.identifier == permissionStatusString);
}