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

@@ -35,7 +35,7 @@ class CartonDataProvider {
}
Future<List<Carton>> searchCarton(String term) async {
if (term == null || term == '') return [];
if (term == '') return [];
// var bytes = utf8.encode(term);
// var base64Str = base64.encode(bytes);

View File

@@ -1,4 +1,3 @@
import 'package:fcs/domain/entities/fcs_shipment.dart';
import 'package:fcs/domain/vo/delivery_address.dart';
import 'package:fcs/helpers/api_helper.dart';
import 'package:fcs/helpers/firebase_helper.dart';

View File

@@ -59,7 +59,6 @@ class MessagingFCM {
}
_onNotify(Map<String, dynamic> message, OnNotify onNotify) {
var data = message['data'] ?? message;
onNotify(Map<String, dynamic>.from(message));
}

View File

@@ -57,7 +57,7 @@ class PackageDataProvider {
}
Future<List<Package>?> ftsSearchPackage(String term) async {
if (term == null || term == '') return [];
if (term == '') return [];
var bytes = utf8.encode(term);
var base64Str = base64.encode(bytes);
@@ -86,8 +86,7 @@ class PackageDataProvider {
}
Future<List<Package>> searchPackage(String term) async {
if (term == null || term == '') return [];
if (term == '') return [];
List<Package> packages = [];
try {

View File

@@ -18,7 +18,7 @@ class PickupDataProvider {
}
Future<List<Pickup>> searchPickup(String term) async {
if (term == null || term == '') return [];
if (term == '') return [];
List<Pickup> pickups = [];

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>(

View File

@@ -53,7 +53,7 @@ class UserDataProvider {
}
Future<List<User>> searchUser(String term) async {
if (term == null || term == '') return [];
if (term == '') return [];
var bytes = utf8.encode(term);
var base64Str = base64.encode(bytes);