cleanup code
This commit is contained in:
@@ -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>(
|
||||
|
||||
Reference in New Issue
Block a user