disable method
Disables the Bluetooth adapter on Android or opens the Bluetooth settings screen on iOS / macOS.
On iOS and macOS the returned value is always ActionResponse.openedIOSSettings.
Implementation
Future<ActionResponse> disable() async {
try {
if (Platform.isAndroid) {
return await bmAndroid.disable();
} else if (Platform.isIOS) {
await bmIOS.openBluetoothSettings();
return ActionResponse.openedIOSSettings;
} else if (Platform.isMacOS) {
await bmMacOS.openBluetoothSettings();
return ActionResponse.openedIOSSettings;
} else {
throw '[disable_bluetooth] platform_not_supported - only Android, iOS and macOS are supported';
}
} catch (e) {
rethrow;
}
}