Closed toulaoBD closed 10 months ago
@kakzaki, getting the same issue while connecting
void _connect() { if (_device != null) { bluetooth.isConnected.then((isConnected) { if (isConnected == true) { show('Device connected!'); bluetooth.connect(_device!).catchError((error) { setState(() => _connected = false); }); setState(() => _connected = true); } else { show('Device not connected!'); } }); } else { show('No device selected.'); } }
The example code has logical error in its condition. Replace if (isConnected==true)
with if (isConnected != true)
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
void _connect() { if (_device == null) { show('No device selected.'); } else { bluetooth.isConnected.then((isConnected) { if (isConnected==true) { bluetooth.connect(_device!).catchError((error) { setState(() => _connected = false); }); setState(() => _connected = true); } }); } }