null safety
This commit is contained in:
@@ -12,9 +12,9 @@ import 'package:logging/logging.dart';
|
|||||||
class DeliveryModel extends BaseModel {
|
class DeliveryModel extends BaseModel {
|
||||||
final log = Logger('DeliveryModel');
|
final log = Logger('DeliveryModel');
|
||||||
List<Carton> get cartons =>
|
List<Carton> get cartons =>
|
||||||
_selectedIndex == 1 ? _cartons : List<Carton>.from(_delivered.values);
|
_selectedIndex == 1 ? _cartons : List<Carton>.from(_delivered?.values ?? []);
|
||||||
|
|
||||||
late Paginator _delivered;
|
Paginator? _delivered;
|
||||||
int _selectedIndex = 1;
|
int _selectedIndex = 1;
|
||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
List<Carton> _cartons = [];
|
List<Carton> _cartons = [];
|
||||||
@@ -31,9 +31,9 @@ class DeliveryModel extends BaseModel {
|
|||||||
_selectedIndex = 1;
|
_selectedIndex = 1;
|
||||||
_loadCartons();
|
_loadCartons();
|
||||||
|
|
||||||
if (_delivered != null) _delivered.close();
|
if (_delivered != null) _delivered!.close();
|
||||||
_delivered = _getDelivered();
|
_delivered = _getDelivered();
|
||||||
_delivered.load();
|
_delivered!.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _loadCartons() async {
|
Future<void> _loadCartons() async {
|
||||||
@@ -82,10 +82,10 @@ class DeliveryModel extends BaseModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> loadMore() async {
|
Future<void> loadMore() async {
|
||||||
if (_delivered.ended || _selectedIndex == 1) return;
|
if (_delivered!.ended || _selectedIndex == 1) return;
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
await _delivered.load(onFinished: () {
|
await _delivered!.load(onFinished: () {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
});
|
});
|
||||||
@@ -94,7 +94,7 @@ class DeliveryModel extends BaseModel {
|
|||||||
Future<void> refresh() async {
|
Future<void> refresh() async {
|
||||||
if (_selectedIndex == 1) return;
|
if (_selectedIndex == 1) return;
|
||||||
|
|
||||||
await _delivered.refresh(onFinished: () {
|
await _delivered!.refresh(onFinished: () {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ class DeliveryModel extends BaseModel {
|
|||||||
@override
|
@override
|
||||||
logout() async {
|
logout() async {
|
||||||
if (listener != null) await listener!.cancel();
|
if (listener != null) await listener!.cancel();
|
||||||
if (_delivered != null) _delivered.close();
|
if (_delivered != null) _delivered!.close();
|
||||||
_cartons = [];
|
_cartons = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class DeliveryAddressModel extends BaseModel {
|
|||||||
.collection("$path")
|
.collection("$path")
|
||||||
.orderBy("full_name")
|
.orderBy("full_name")
|
||||||
.get();
|
.get();
|
||||||
return querySnap.docs
|
return querySnap.docs
|
||||||
.map((e) =>
|
.map((e) =>
|
||||||
DeliveryAddress.fromMap(e.data as Map<String, dynamic>, e.id))
|
DeliveryAddress.fromMap(e.data as Map<String, dynamic>, e.id))
|
||||||
.toList();
|
.toList();
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ Future<void> showConfirmDialog(
|
|||||||
child: LocalText(
|
child: LocalText(
|
||||||
context,
|
context,
|
||||||
translationKey,
|
translationKey,
|
||||||
translationVariables: translationVariables!,
|
translationVariables: translationVariables,
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
23
pubspec.lock
23
pubspec.lock
@@ -7,14 +7,14 @@ packages:
|
|||||||
name: _fe_analyzer_shared
|
name: _fe_analyzer_shared
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "22.0.0"
|
version: "25.0.0"
|
||||||
analyzer:
|
analyzer:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: analyzer
|
name: analyzer
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.1"
|
version: "2.2.0"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -28,7 +28,7 @@ packages:
|
|||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.6.1"
|
version: "2.8.1"
|
||||||
barcode_scan2:
|
barcode_scan2:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -91,7 +91,7 @@ packages:
|
|||||||
name: charcode
|
name: charcode
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.3.1"
|
||||||
cli_util:
|
cli_util:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -434,6 +434,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "9.1.0"
|
version: "9.1.0"
|
||||||
|
frontend_server_client:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: frontend_server_client
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.2"
|
||||||
glob:
|
glob:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -531,7 +538,7 @@ packages:
|
|||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.7.0"
|
||||||
mime:
|
mime:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -893,21 +900,21 @@ packages:
|
|||||||
name: test
|
name: test
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.16.8"
|
version: "1.17.10"
|
||||||
test_api:
|
test_api:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.0"
|
version: "0.4.2"
|
||||||
test_core:
|
test_core:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_core
|
name: test_core
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.19"
|
version: "0.4.0"
|
||||||
timeline_list:
|
timeline_list:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
Reference in New Issue
Block a user