check null safety
This commit is contained in:
@@ -2,7 +2,6 @@ import 'dart:async';
|
||||
|
||||
import 'package:fcs/data/services/services.dart';
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/domain/entities/custom_duty.dart';
|
||||
import 'package:fcs/domain/entities/discount_by_weight.dart';
|
||||
import 'package:fcs/domain/entities/rate.dart';
|
||||
import 'package:fcs/pages/main/model/base_model.dart';
|
||||
@@ -11,12 +10,12 @@ import 'package:logging/logging.dart';
|
||||
class ShipmentRateModel extends BaseModel {
|
||||
final log = Logger('ShipmentRateModel');
|
||||
|
||||
StreamSubscription<Rate> listener;
|
||||
Rate rate;
|
||||
StreamSubscription<Rate>? listener;
|
||||
late Rate rate;
|
||||
|
||||
void initUser(user) {
|
||||
super.initUser(user);
|
||||
if (listener != null) listener.cancel();
|
||||
if (listener != null) listener!.cancel();
|
||||
listener = Services.instance.rateService.getRateStream().listen((rate) {
|
||||
this.rate = rate;
|
||||
notifyListeners();
|
||||
@@ -25,7 +24,7 @@ class ShipmentRateModel extends BaseModel {
|
||||
|
||||
@override
|
||||
logout() async {
|
||||
if (listener != null) await listener.cancel();
|
||||
if (listener != null) await listener!.cancel();
|
||||
}
|
||||
|
||||
// Rate
|
||||
@@ -51,12 +50,12 @@ class ShipmentRateModel extends BaseModel {
|
||||
//CustomDuty
|
||||
|
||||
Future<void> addCustomDuty(CargoType customDuty) {
|
||||
customDuty.isCutomDuty=true;
|
||||
customDuty.isCutomDuty = true;
|
||||
return Services.instance.rateService.createCargoType(customDuty);
|
||||
}
|
||||
|
||||
Future<void> updateCustomDuty(CargoType customDuty) {
|
||||
customDuty.isCutomDuty=true;
|
||||
customDuty.isCutomDuty = true;
|
||||
return Services.instance.rateService.updateCargoType(customDuty);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user