`this is the function I use to connect:
try { // Connect to the device. setState(() { isabs=true; });
setState(() {
loading=true;
});
connection = await BluetoothConnection.toAddress(device.address);
setState(() {
isabs=false;
});
setState(() {
loading=false;
});
Navigator.pushReplacement(context, BluetoothControllerApp() as Route<Object?>);
await connection?.close();
} catch (e) {
print(connection?.isConnected);
setState(() {
isabs=false;
});
// Navigator.pop(context);
// Navigator.push(context, DevicesList() as Route<Object?>);
setState(() {
loading=false;
});
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text('Can\'t Connect'),
content: Text('Bluetooth Device is not available'),
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: Container(
color: Colors.blueGrey,
child: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(Icons.arrow_right,size: 50,color: Colors.white,),
),
),
),
],
),
],
),
);
print(e.toString());
}
and I get that in the terminal: I/BluetoothAdapter(14434): cancelDiscovery I/BluetoothAdapter(14434): cancelDiscovery = false D/BluetoothUtils(14434): isSocketAllowedBySecurityPolicy start : device null I/BluetoothSocket(14434): connect() for device 414200 called by pid: 14434 W/BluetoothAdapter(14434): getBluetoothService() called with no BluetoothManagerCallback and the dialog can't connect any help please
I don't know what to try I followed the flutter dependency documentation _ chatGpt yet still not working`