BluetoothPermissionHelper class

Helper for verifying and requesting Bluetooth permissions across Android versions. Fully compatible from Android 10 (API 29) through Android 17 (API 37+).

Constructors

BluetoothPermissionHelper()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

mockIsAndroid ↔ bool?
For mocking Android platform during tests on non-Android CI runners.
getter/setter pair

Static Methods

arePermissionsGranted() → Future<bool>
Checks if all required permissions are currently granted without prompting the user.
checkAndRequestPermissions({bool openSettingsIfPermanentlyDenied = true}) → Future<bool>
Requests the necessary Bluetooth and Location permissions compatible with Android 10 - 17.
getAndroidSdkVersion() → Future<int?>
Retrieves the Android SDK version (e.g. 29 for Android 10, 35 for Android 15). Returns null on non-Android platforms or if detection fails.
getFallbackPermissions() → List<Permission>
Synchronous fallback permission list when async resolution is not possible.
getRequiredBluetoothPermissions() → Future<List<Permission>>
Returns the list of Permissions required for Bluetooth on the current platform/version.
setMockSdkVersion(int? sdkInt, {bool isAndroid = true}) → void
Sets mock SDK version (primarily for unit tests).