@pauldemarco, please, change your mind about using RxDart.
RxDart use brainless and unusable logic.
Examle. With old code i can do next thing:
flutterBlue=FlutterBlue.instance;
_conn=flutterBlue.connect(scanResult.device, timeout: Duration(seconds: 5),
autoConnect: false).listen(
(x){
if (x==BluetoothDeviceState.connected) {
_conn?.cancel();
_conn=null;
if (mounted) {
setState(() {
..............
});
}
}
},
cancelOnError: true
);
With this code i can have both - connection and state listener. And i can use one variable to store state and connection, so i can just use _conn.cancel() to disconnect device and stop to listen device state.
But with new API i need to have atleast two variables to store device and device state, also i have to change all my program code and logic to use StreamBuilders everywhere to see if there is errors etc.
Please, change your mind about DartRx, ty.
@woozbooz If you want you still can use the old (0.5.0) version.
But with the new flutter stable (1.7.8), 0.5.0 doesn't work anymore in debug on Android (due to changes on FlutterJNI) . So I made a 0.5.0 fork compatible version if you want : https://github.com/bpillon/flutter_blue
@bpillon, TY, i will check it later.
Did it compatible with 1.7.8?
Yes the fork is working with 1.7.8!
Agree with the original poster. With such major API changes so far down the road this package should have been renamed, or at very least some clear migration guide should have been provided.
The current version has some major issues with #311 and #317 and therefore fails for anything but the most basic use cases. Otherwise, the idea of using RxDart is not a bad one, imo, its easier to read and clearer. But thats not worth losing functionality ...
The changes on the api were AWESOME, rxdart is amazing and makes everything easier. BUT! the basic functionallity simply stopped working. I just can't write characteristics aymore #331 .
:'(
Unfortunately, we have all been warned of possible breaking changes in the README
Most helpful comment
@woozbooz If you want you still can use the old (0.5.0) version.
But with the new flutter stable (1.7.8), 0.5.0 doesn't work anymore in debug on Android (due to changes on FlutterJNI) . So I made a 0.5.0 fork compatible version if you want : https://github.com/bpillon/flutter_blue