requestBluetoothPermission method

  1. @override
Future<bool> requestBluetoothPermission()
override

Requests required bluetooth permissions directly without 3rd party plugins.

Implementation

@override
Future<bool> requestBluetoothPermission() async {
  try {
    final isGranted = await methodChannel
        .invokeMethod<bool>('requestBluetoothPermission')
        .timeout(const Duration(seconds: 30)); // allow time for user prompt
    return isGranted ?? false;
  } catch (e, stack) {
    debugPrint('AudioPicker: requestBluetoothPermission error: $e\n$stack');
    return false;
  }
}