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'; return 'https://dashboard.stripe.com/sources/$transactionReference';
else else
return 'https://dashboard.stripe.com/payments/$transactionReference'; return 'https://dashboard.stripe.com/payments/$transactionReference';
break;
default: default:
return null; return null;
} }

View File

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

View File

@ -329,7 +329,7 @@ abstract class PaymentEntity extends Object
case PaymentFields.type: case PaymentFields.type:
final typeA = paymentTypeMap![paymentA!.typeId] ?? PaymentTypeEntity(); final typeA = paymentTypeMap![paymentA!.typeId] ?? PaymentTypeEntity();
final typeB = paymentTypeMap[paymentB!.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; break;
case EntityFields.assignedTo: case EntityFields.assignedTo:
final userA = userMap![paymentA!.assignedUserId] ?? UserEntity(); final userA = userMap![paymentA!.assignedUserId] ?? UserEntity();

View File

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

View File

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

View File

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