Flutter Blue Setting Notifications
I found https://github.com/Sensirion/smart-gadget-flutter/tree/master/lib and I was able to fix my problem using the following code:
for(BluetoothService service in services) { for(BluetoothCharacteristic c in service.characteristics) { if(c.uuid == new Guid("0000ffe1-0000-1000-8000-00805f9b34fb")) { _setNotification(c); } else { print("Nope"); } } }
This was added in the _connect function.
_connect(BluetoothDevice d) async { device = d;// Connect to device deviceConnection = _flutterBlue .connect(device, timeout: const Duration(seconds: 4)) .listen( null, onDone: _disconnect, );// Update the connection state immediately device.state.then((s) { setState(() { deviceState = s; }); });// Subscribe to connection changes deviceStateSubscription = device.onStateChanged().listen((s) { setState(() { deviceState = s; }); if (s == BluetoothDeviceState.connected) { device.discoverServices().then((s) { services = s; for(BluetoothService service in services) { for(BluetoothCharacteristic c in service.characteristics) { if(c.uuid == new Guid("0000ffe1-0000-1000-8000-00805f9b34fb")) { _setNotification(c); } else { print("Nope"); } } } setState(() { services = s; }); _getServices(); }); } }); }