0

See error screenshot

I'm trying to monitor the state of the bluetooth device. For example a users bluetooth is turned on before entering the app. I want the bluetooth swtich to be turned on in the app. I am using GetX for state management

BluetoothState bluetoothState = BluetoothState.UNKNOWN;
 Future<void> enableBluetooth() async {
// Retrieving the current Bluetooth state
      bluetoothState = await 
FlutterBluetoothSerial.instance.state.;
// If the bluetooth is off, then turn it on first
// and then retrieve the devices that are paired.
if (bluetoothState == BluetoothState.STATE_OFF) {
  await FlutterBluetoothSerial.instance.requestEnable();
  await getPairedDevices();
  return true;
} else {
  await getPairedDevices();
}
return false;

}

Wesle6
  • 31
  • 3

0 Answers0