Skip to content

Instantly share code, notes, and snippets.

@epietrowicz
Created May 13, 2020 14:56
Show Gist options
  • Save epietrowicz/9410053acabaa6a337376f67bd68401d to your computer and use it in GitHub Desktop.
Save epietrowicz/9410053acabaa6a337376f67bd68401d to your computer and use it in GitHub Desktop.
connector
void _connectDevice(BluetoothDevice device) async {
flutterBlue.stopScan();
try {
await device.connect();
} catch (e) {
if (e.code != 'already_connected') {
throw e;
}
} finally {
List<BluetoothService> services = await device.discoverServices();
_getLEDChar(services);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment