Null safety

This commit is contained in:
Hillel Coren 2023-10-01 16:07:32 +03:00
parent e22c4a5228
commit be31e0c9da
6 changed files with 15 additions and 12 deletions

View File

@ -973,7 +973,6 @@ abstract class GatewayEntity extends Object
return 'https://dashboard.stripe.com/sources/$transactionReference';
else
return 'https://dashboard.stripe.com/payments/$transactionReference';
break;
default:
return null;
}

View File

@ -1447,12 +1447,13 @@ abstract class InvoiceEntity extends Object
return taxes;
}
void _calculateTax(Map<String, Map<String, dynamic>> map, String name,
double rate, double amount, double paid) {
if (amount == null) {
return;
}
void _calculateTax(
Map<String, Map<String, dynamic>> map,
String name,
double rate,
double amount,
double paid,
) {
final key = rate.toString() + ' ' + name;
map.putIfAbsent(

View File

@ -329,7 +329,7 @@ abstract class PaymentEntity extends Object
case PaymentFields.type:
final typeA = paymentTypeMap![paymentA!.typeId] ?? PaymentTypeEntity();
final typeB = paymentTypeMap[paymentB!.typeId] ?? PaymentTypeEntity();
return typeA.name.toLowerCase().compareTo(typeB.name.toLowerCase());
response = typeA.name.toLowerCase().compareTo(typeB.name.toLowerCase());
break;
case EntityFields.assignedTo:
final userA = userMap![paymentA!.assignedUserId] ?? UserEntity();

View File

@ -98,10 +98,10 @@ class VendorOverview extends StatelessWidget {
memoizedCalculateVendorBalance(vendor.id, vendor.currencyId,
state.expenseState.map, state.expenseState.list),
context,
currencyId: vendor.currencyId ?? company.currencyId),
currencyId: vendor.currencyId),
),
ListDivider(),
if ((vendor.privateNotes ?? '').isNotEmpty) ...[
if (vendor.privateNotes.isNotEmpty) ...[
IconMessage(vendor.privateNotes,
iconData: Icons.lock, copyToClipboard: true),
ListDivider()

View File

@ -43,7 +43,7 @@ String toSpaceCase(String value) {
}
String toTitleCase(String text) {
if ((text ?? '').isEmpty) {
if (text.isEmpty) {
return '';
}

View File

@ -84,7 +84,10 @@ class WebUtils {
final loginRequest = PopupRequest()..scopes = ['user.read'];
publicClientApp.loginPopup(loginRequest).then((result) {
succesCallback(result.idToken ?? '', result.accessToken ?? '');
succesCallback(
result.idToken,
result.accessToken,
);
}).catchError((dynamic error) {
failureCallback(error);
});