enable method

Calls BluetoothAdapter.enable() on the native side.

Note: starting with Android 13 (API 33) this API is deprecated and no longer works for non-privileged apps — the plugin returns ActionResponse.responseError in that case.

Implementation

Future<ActionResponse> enable() async {
  try {
    final result = await _channel.invokeMethod<String>('enableBluetooth');
    return enumFromString(ActionResponse.values, result) ??
        ActionResponse.responseError;
  } catch (_) {
    return ActionResponse.responseError;
  }
}