cleanup code

This commit is contained in:
tzw
2024-01-23 16:28:08 +06:30
parent a1e87cdbf6
commit f3f75a80c6
96 changed files with 232 additions and 439 deletions

View File

@@ -86,10 +86,10 @@ class RateDataProvider {
}
}
late StreamSubscription<Rate> rateListener;
late StreamSubscription<List<CargoType>> cargoListener;
late StreamSubscription<List<CargoType>> customListener;
late StreamSubscription<List<DiscountByWeight>> discountListener;
late StreamSubscription<Rate>? rateListener;
late StreamSubscription<List<CargoType>>? cargoListener;
late StreamSubscription<List<CargoType>>? customListener;
late StreamSubscription<List<DiscountByWeight>>? discountListener;
Stream<Rate> rate() {
Future<void> _start() async {
rateListener = _rateStream().listen((rate) {
@@ -115,18 +115,10 @@ class RateDataProvider {
}
void _stop() {
if (rateListener != null) {
rateListener.cancel();
}
if (cargoListener != null) {
cargoListener.cancel();
}
if (customListener != null) {
customListener.cancel();
}
if (discountListener != null) {
discountListener.cancel();
}
rateListener?.cancel();
cargoListener?.cancel();
customListener?.cancel();
discountListener?.cancel();
}
controller = StreamController<Rate>(