openBluetoothSettings method

Future<void> openBluetoothSettings()

Opens settings so the user can enable or disable Bluetooth.

Uses a native method that tries Bluetooth-specific URLs first, then falls back to UIApplication.openSettingsURLString when the system rejects those (common on current iOS). Throws if nothing could be opened.

Implementation

Future<void> openBluetoothSettings() async {
  try {
    await _channel.invokeMethod<void>('openBluetoothSettings');
  } on PlatformException catch (e) {
    throw Exception(e.message ?? 'Could not open Bluetooth settings');
  }
}