turnOff static method

  1. @Deprecated('Deprecated in Android SDK 33 with no replacement')
Future<void> turnOff({
  1. int timeout = 10,
})

Turn off Bluetooth (Android only),

Implementation

@Deprecated('Deprecated in Android SDK 33 with no replacement')
static Future<void> turnOff({int timeout = 10}) async {
  Stream<BluetoothAdapterState> responseStream = adapterState.where((s) => s == BluetoothAdapterState.off);

  // Start listening now, before invokeMethod, to ensure we don't miss the response
  Future<BluetoothAdapterState> futureResponse = responseStream.first;

  // invoke
  await _invokeMethod('turnOff');

  // wait for response
  await futureResponse.fbpTimeout(timeout, "turnOff");
}