Null safety

This commit is contained in:
Hillel Coren 2023-09-18 23:34:25 +03:00
parent 63e3efc406
commit 3b3dd7c91d
25 changed files with 100 additions and 78 deletions

View File

@ -135,7 +135,8 @@ class _HistoryListTileState extends State<HistoryListTile> {
} else if (history.id == null) { } else if (history.id == null) {
title = Text(localization!.lookup(history.entityType.plural)!); title = Text(localization!.lookup(history.entityType.plural)!);
} else { } else {
entity = state.getEntityMap(history.entityType)![history.id] as BaseEntity?; entity =
state.getEntityMap(history.entityType)![history.id] as BaseEntity?;
if (entity == null) { if (entity == null) {
return SizedBox(); return SizedBox();
@ -260,9 +261,9 @@ class _HistoryListTileState extends State<HistoryListTile> {
entities: [entity], entities: [entity],
completer: state.prefState.isHistoryFloated completer: state.prefState.isHistoryFloated
? (Completer<Null>() ? (Completer<Null>()
..future.then((value) { ..future.then<Null>(() {
Navigator.pop(context); Navigator.pop(context);
} as FutureOr<_> Function(Null))) } as FutureOr<Null> Function(Null)))
: null, : null,
); );
}, },

View File

@ -24,7 +24,7 @@ class IconMessage extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 20), padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 20),
child: Row( child: Row(
children: <Widget?>[ children: <Widget>[
Icon( Icon(
iconData ?? Icons.info_outline, iconData ?? Icons.info_outline,
size: 18.0, size: 18.0,
@ -53,7 +53,7 @@ class IconMessage extends StatelessWidget {
), ),
if (trailing != null) ...[ if (trailing != null) ...[
SizedBox(width: 16), SizedBox(width: 16),
trailing, trailing!,
] ]
], ],
), ),

View File

@ -258,8 +258,8 @@ class _MenuDrawerState extends State<MenuDrawer> {
} else if (companyId == 'company') { } else if (companyId == 'company') {
widget.viewModel.onAddCompany(context); widget.viewModel.onAddCompany(context);
} else { } else {
final company = final company = state.companies
state.companies.firstWhere((company) => company!.id == companyId); .firstWhere((company) => company!.id == companyId)!;
final index = state.companies.indexOf(company); final index = state.companies.indexOf(company);
widget.viewModel.onCompanyChanged(context, index, company); widget.viewModel.onCompanyChanged(context, index, company);
} }
@ -332,8 +332,8 @@ class _MenuDrawerState extends State<MenuDrawer> {
widget.viewModel.onAddCompany(context); widget.viewModel.onAddCompany(context);
} else { } else {
final index = int.parse(value); final index = int.parse(value);
widget.viewModel widget.viewModel.onCompanyChanged(
.onCompanyChanged(context, index, state.companies[index]); context, index, state.companies[index]!);
} }
}, },
), ),
@ -486,7 +486,8 @@ class _MenuDrawerState extends State<MenuDrawer> {
child: ListTile( child: ListTile(
tileColor: Colors.orange.shade800, tileColor: Colors.orange.shade800,
subtitle: Text( subtitle: Text(
localization.verifyPhoneNumber2faHelp!, localization
.verifyPhoneNumber2faHelp!,
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
), ),
onTap: () { onTap: () {
@ -1314,8 +1315,9 @@ class SidebarFooterCollapsed extends StatelessWidget {
Icons.chevron_right, Icons.chevron_right,
color: state.isUpdateAvailable ? state.accentColor : null, color: state.isUpdateAvailable ? state.accentColor : null,
), ),
tooltip: tooltip: state.prefState.enableTooltips
state.prefState.enableTooltips ? localization!.showMenu : null, ? localization!.showMenu
: null,
onPressed: () { onPressed: () {
store.dispatch(UpdateUserPreferences(sidebar: AppSidebar.menu)); store.dispatch(UpdateUserPreferences(sidebar: AppSidebar.menu));
}, },

View File

@ -54,7 +54,7 @@ class MenuDrawerVM {
final CompanyEntity? selectedCompany; final CompanyEntity? selectedCompany;
final UserEntity? user; final UserEntity? user;
final String selectedCompanyIndex; final String selectedCompanyIndex;
final Function(BuildContext context, int, CompanyEntity?) onCompanyChanged; final Function(BuildContext context, int, CompanyEntity) onCompanyChanged;
final Function(BuildContext context) onAddCompany; final Function(BuildContext context) onAddCompany;
final Function(BuildContext) onLogoutTap; final Function(BuildContext) onLogoutTap;
@ -140,7 +140,7 @@ class MenuDrawerVM {
shouldPop: true) shouldPop: true)
..future.then((value) { ..future.then((value) {
AppBuilder.of(navigatorKey.currentContext!)!.rebuild(); AppBuilder.of(navigatorKey.currentContext!)!.rebuild();
} as FutureOr<_> Function(Null)); } as FutureOr<Null> Function(Null));
store store
.dispatch(AddCompany(context: context, completer: completer)); .dispatch(AddCompany(context: context, completer: completer));

View File

@ -184,11 +184,13 @@ class _LoginState extends State<LoginView> {
} }
final Completer<Null> completer = Completer<Null>(); final Completer<Null> completer = Completer<Null>();
completer.future.then((_) { completer.future
.then((_) {
setState(() { setState(() {
_loginError = ''; _loginError = '';
}); });
} as FutureOr<_> Function(Null)).catchError((Object error) { } as FutureOr<_> Function(Null))
.catchError((Object error) {
setState(() { setState(() {
_buttonController.reset(); _buttonController.reset();
_loginError = error.toString(); _loginError = error.toString();
@ -225,7 +227,8 @@ class _LoginState extends State<LoginView> {
} }
final Completer<Null> completer = Completer<Null>(); final Completer<Null> completer = Completer<Null>();
completer.future.then((_) { completer.future
.then<Null>(() {
setState(() { setState(() {
_loginError = ''; _loginError = '';
if (_recoverPassword) { if (_recoverPassword) {
@ -240,7 +243,8 @@ class _LoginState extends State<LoginView> {
}); });
} }
}); });
} as FutureOr<_> Function(Null)).catchError((Object error) { } as FutureOr<Null> Function(Null))
.catchError((Object error) {
setState(() { setState(() {
_buttonController.reset(); _buttonController.reset();
_loginError = error.toString(); _loginError = error.toString();
@ -512,8 +516,9 @@ class _LoginState extends State<LoginView> {
children: <TextSpan>[ children: <TextSpan>[
TextSpan( TextSpan(
style: aboutTextStyle, style: aboutTextStyle,
text: localization!.iAgreeToThe + text:
' ', localization!.iAgreeToThe +
' ',
), ),
LinkTextSpan( LinkTextSpan(
style: linkStyle, style: linkStyle,

View File

@ -115,7 +115,9 @@ class LoginVM {
onMicrosoftSignUpPressed; onMicrosoftSignUpPressed;
final Function(BuildContext, Completer<Null> completer, final Function(BuildContext, Completer<Null> completer,
{String url, String? secret, String? oneTimePassword}) onAppleLoginPressed; {String url,
String? secret,
String? oneTimePassword}) onAppleLoginPressed;
final Function(BuildContext, Completer<Null> completer, String? url) final Function(BuildContext, Completer<Null> completer, String? url)
onAppleSignUpPressed; onAppleSignUpPressed;
@ -184,7 +186,8 @@ class LoginVM {
provider: UserEntity.OAUTH_PROVIDER_GOOGLE, provider: UserEntity.OAUTH_PROVIDER_GOOGLE,
oneTimePassword: oneTimePassword, oneTimePassword: oneTimePassword,
)); ));
completer.future.then(((_) => _handleLogin(context: context)) as FutureOr<_> Function(Null)); completer.future.then<Null>((() => _handleLogin(context: context))
as FutureOr<Null> Function(Null));
} }
}); });
if (!signedIn) { if (!signedIn) {
@ -214,8 +217,9 @@ class LoginVM {
accessToken: accessToken, accessToken: accessToken,
provider: UserEntity.OAUTH_PROVIDER_GOOGLE, provider: UserEntity.OAUTH_PROVIDER_GOOGLE,
)); ));
completer.future completer.future.then<Null>((() =>
.then(((_) => _handleLogin(context: context, isSignUp: true)) as FutureOr<_> Function(Null)); _handleLogin(context: context, isSignUp: true))
as FutureOr<Null> Function(Null));
} }
}); });
if (!signedIn) { if (!signedIn) {
@ -231,9 +235,9 @@ class LoginVM {
onMicrosoftLoginPressed: ( onMicrosoftLoginPressed: (
BuildContext context, BuildContext context,
Completer<Null> completer, { Completer<Null> completer, {
required String url, String url = '',
required String secret, String secret = '',
required String oneTimePassword, String oneTimePassword = '',
}) async { }) async {
try { try {
WebUtils.microsoftLogin((idToken, accessToken) { WebUtils.microsoftLogin((idToken, accessToken) {
@ -247,7 +251,8 @@ class LoginVM {
provider: UserEntity.OAUTH_PROVIDER_MICROSOFT, provider: UserEntity.OAUTH_PROVIDER_MICROSOFT,
oneTimePassword: oneTimePassword, oneTimePassword: oneTimePassword,
)); ));
completer.future.then(((_) => _handleLogin(context: context)) as FutureOr<_> Function(Null)); completer.future.then<Null>((() => _handleLogin(context: context))
as FutureOr<Null> Function(Null));
}, (dynamic error) { }, (dynamic error) {
completer.completeError(error); completer.completeError(error);
}); });
@ -267,8 +272,9 @@ class LoginVM {
provider: UserEntity.OAUTH_PROVIDER_MICROSOFT, provider: UserEntity.OAUTH_PROVIDER_MICROSOFT,
accessToken: accessToken, accessToken: accessToken,
)); ));
completer.future completer.future.then<Null>((() =>
.then(((_) => _handleLogin(context: context, isSignUp: true)) as FutureOr<_> Function(Null)); _handleLogin(context: context, isSignUp: true))
as FutureOr<Null> Function(Null));
}, (dynamic error) { }, (dynamic error) {
completer.completeError(error); completer.completeError(error);
}); });
@ -307,7 +313,8 @@ class LoginVM {
authCode: credentials.authorizationCode, authCode: credentials.authorizationCode,
idToken: credentials.identityToken, idToken: credentials.identityToken,
)); ));
completer.future.then(((_) => _handleLogin(context: context)) as FutureOr<_> Function(Null)); completer.future.then<Null>((() => _handleLogin(context: context))
as FutureOr<Null> Function(Null));
} catch (error) { } catch (error) {
completer.completeError(error); completer.completeError(error);
print('## onAppleLoginPressed: $error'); print('## onAppleLoginPressed: $error');
@ -335,8 +342,9 @@ class LoginVM {
firstName: credentials.givenName, firstName: credentials.givenName,
lastName: credentials.familyName, lastName: credentials.familyName,
)); ));
completer.future completer.future.then<Null>((() =>
.then(((_) => _handleLogin(context: context, isSignUp: true)) as FutureOr<_> Function(Null)); _handleLogin(context: context, isSignUp: true))
as FutureOr<Null> Function(Null));
} catch (error) { } catch (error) {
completer.completeError(error); completer.completeError(error);
print('## onAppleSignUpPressed: $error'); print('## onAppleSignUpPressed: $error');
@ -357,8 +365,9 @@ class LoginVM {
email: email.trim(), email: email.trim(),
password: password.trim(), password: password.trim(),
)); ));
completer.future completer.future.then<Null>((() =>
.then(((_) => _handleLogin(context: context, isSignUp: true)) as FutureOr<_> Function(Null)); _handleLogin(context: context, isSignUp: true))
as FutureOr<Null> Function(Null));
}, },
onRecoverPressed: ( onRecoverPressed: (
BuildContext context, BuildContext context,
@ -400,7 +409,8 @@ class LoginVM {
platform: getPlatform(context), platform: getPlatform(context),
oneTimePassword: oneTimePassword.trim(), oneTimePassword: oneTimePassword.trim(),
)); ));
completer.future.then(((_) => _handleLogin(context: context)) as FutureOr<_> Function(Null)); completer.future.then<Null>((() => _handleLogin(context: context))
as FutureOr<Null> Function(Null));
}, },
onTokenLoginPressed: (BuildContext context, Completer<Null> completer, onTokenLoginPressed: (BuildContext context, Completer<Null> completer,
{required String token}) async { {required String token}) async {

View File

@ -59,7 +59,8 @@ class EmailCreditVM extends EmailEntityVM {
ClientEntity? client, ClientEntity? client,
VendorEntity? vendor, VendorEntity? vendor,
Function? loadClient, Function? loadClient,
Function(BuildContext, EmailTemplate, String, String, String)? onSendPressed, Function(BuildContext, EmailTemplate, String, String, String)?
onSendPressed,
}) : super( }) : super(
state: state, state: state,
isLoading: isLoading, isLoading: isLoading,
@ -91,7 +92,7 @@ class EmailCreditVM extends EmailEntityVM {
if (!isMobile(context)) { if (!isMobile(context)) {
completer.future.then((value) { completer.future.then((value) {
viewEntity(entity: credit); viewEntity(entity: credit);
} as FutureOr<_> Function(Null)); } as FutureOr<Null> Function(Null));
} }
store.dispatch(EmailCreditRequest( store.dispatch(EmailCreditRequest(
completer: completer, completer: completer,

View File

@ -103,7 +103,7 @@ class CreditEditDetailsVM extends EntityEditDetailsVM {
cancelCompleter: Completer<Null>() cancelCompleter: Completer<Null>()
..future.then((_) { ..future.then((_) {
store.dispatch(UpdateCurrentRoute(CreditEditScreen.route)); store.dispatch(UpdateCurrentRoute(CreditEditScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity client) { completer.future.then((SelectableEntity client) {
store.dispatch(UpdateCurrentRoute(CreditEditScreen.route)); store.dispatch(UpdateCurrentRoute(CreditEditScreen.route));
}); });

View File

@ -131,7 +131,7 @@ class InvoiceEditDetailsVM extends EntityEditDetailsVM {
cancelCompleter: Completer<Null>() cancelCompleter: Completer<Null>()
..future.then((_) { ..future.then((_) {
store.dispatch(UpdateCurrentRoute(InvoiceEditScreen.route)); store.dispatch(UpdateCurrentRoute(InvoiceEditScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity client) { completer.future.then((SelectableEntity client) {
store.dispatch(UpdateCurrentRoute(InvoiceEditScreen.route)); store.dispatch(UpdateCurrentRoute(InvoiceEditScreen.route));
}); });

View File

@ -81,7 +81,8 @@ class EmailInvoiceVM extends EmailEntityVM {
InvoiceEntity? invoice, InvoiceEntity? invoice,
ClientEntity? client, ClientEntity? client,
VendorEntity? vendor, VendorEntity? vendor,
Function(BuildContext, EmailTemplate, String, String, String)? onSendPressed, Function(BuildContext, EmailTemplate, String, String, String)?
onSendPressed,
}) : super( }) : super(
state: state, state: state,
isLoading: isLoading, isLoading: isLoading,
@ -112,7 +113,7 @@ class EmailInvoiceVM extends EmailEntityVM {
if (!isMobile(context)) { if (!isMobile(context)) {
completer.future.then((value) { completer.future.then((value) {
viewEntity(entity: invoice); viewEntity(entity: invoice);
} as FutureOr<_> Function(Null)); } as FutureOr<Null> Function(Null));
} }
store.dispatch(EmailInvoiceRequest( store.dispatch(EmailInvoiceRequest(
completer: completer, completer: completer,

View File

@ -90,7 +90,7 @@ class ProjectEditVM {
cancelCompleter: Completer<Null>() cancelCompleter: Completer<Null>()
..future.then((_) { ..future.then((_) {
store.dispatch(UpdateCurrentRoute(ProjectEditScreen.route)); store.dispatch(UpdateCurrentRoute(ProjectEditScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity client) { completer.future.then((SelectableEntity client) {
store.dispatch(UpdateCurrentRoute(ProjectEditScreen.route)); store.dispatch(UpdateCurrentRoute(ProjectEditScreen.route));
}); });

View File

@ -106,7 +106,7 @@ class PurchaseOrderEditDetailsVM extends EntityEditDetailsVM {
..future.then((_) { ..future.then((_) {
store.dispatch( store.dispatch(
UpdateCurrentRoute(PurchaseOrderEditScreen.route)); UpdateCurrentRoute(PurchaseOrderEditScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity client) { completer.future.then((SelectableEntity client) {
store.dispatch(UpdateCurrentRoute(PurchaseOrderEditScreen.route)); store.dispatch(UpdateCurrentRoute(PurchaseOrderEditScreen.route));
}); });

View File

@ -58,9 +58,8 @@ class EmailPurchaseOrderVM extends EmailEntityVM {
required InvoiceEntity invoice, required InvoiceEntity invoice,
required ClientEntity? client, required ClientEntity? client,
required VendorEntity? vendor, required VendorEntity? vendor,
required required Function(BuildContext, EmailTemplate, String, String, String)
Function(BuildContext, EmailTemplate, String, String, String) onSendPressed,
onSendPressed,
}) : super( }) : super(
state: state, state: state,
isLoading: isLoading, isLoading: isLoading,
@ -91,7 +90,7 @@ class EmailPurchaseOrderVM extends EmailEntityVM {
if (!isMobile(context)) { if (!isMobile(context)) {
completer.future.then((value) { completer.future.then((value) {
viewEntity(entity: purchaseOrder); viewEntity(entity: purchaseOrder);
} as FutureOr<_> Function(Null)); } as FutureOr<Null> Function(Null));
} }
store.dispatch(EmailPurchaseOrderRequest( store.dispatch(EmailPurchaseOrderRequest(
completer: completer, completer: completer,

View File

@ -102,7 +102,7 @@ class QuoteEditDetailsVM extends EntityEditDetailsVM {
cancelCompleter: Completer<Null>() cancelCompleter: Completer<Null>()
..future.then((_) { ..future.then((_) {
store.dispatch(UpdateCurrentRoute(QuoteEditScreen.route)); store.dispatch(UpdateCurrentRoute(QuoteEditScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity client) { completer.future.then((SelectableEntity client) {
store.dispatch(UpdateCurrentRoute(QuoteEditScreen.route)); store.dispatch(UpdateCurrentRoute(QuoteEditScreen.route));
}); });

View File

@ -58,9 +58,8 @@ class EmailQuoteVM extends EmailEntityVM {
required InvoiceEntity invoice, required InvoiceEntity invoice,
required ClientEntity? client, required ClientEntity? client,
required VendorEntity? vendor, required VendorEntity? vendor,
required required Function(BuildContext, EmailTemplate, String, String, String)
Function(BuildContext, EmailTemplate, String, String, String) onSendPressed,
onSendPressed,
}) : super( }) : super(
state: state, state: state,
isLoading: isLoading, isLoading: isLoading,
@ -90,7 +89,7 @@ class EmailQuoteVM extends EmailEntityVM {
if (!isMobile(context)) { if (!isMobile(context)) {
completer.future.then((value) { completer.future.then((value) {
viewEntity(entity: quote); viewEntity(entity: quote);
} as FutureOr<_> Function(Null)); } as FutureOr<Null> Function(Null));
} }
store.dispatch(EmailQuoteRequest( store.dispatch(EmailQuoteRequest(
completer: completer, completer: completer,

View File

@ -62,7 +62,8 @@ class RecurringExpenseEditVM extends AbstractExpenseEditVM {
state: state, state: state,
expense: expense, expense: expense,
onChanged: onChanged, onChanged: onChanged,
onSavePressed: onSavePressed as dynamic Function(BuildContext, [EntityAction])?, onSavePressed:
onSavePressed as dynamic Function(BuildContext, [EntityAction])?,
onCancelPressed: onCancelPressed, onCancelPressed: onCancelPressed,
origExpense: origExpense, origExpense: origExpense,
onAddClientPressed: onAddClientPressed, onAddClientPressed: onAddClientPressed,
@ -93,7 +94,7 @@ class RecurringExpenseEditVM extends AbstractExpenseEditVM {
..future.then((_) { ..future.then((_) {
store.dispatch( store.dispatch(
UpdateCurrentRoute(RecurringExpenseEditScreen.route)); UpdateCurrentRoute(RecurringExpenseEditScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity client) { completer.future.then((SelectableEntity client) {
store.dispatch(UpdateCurrentRoute(RecurringExpenseEditScreen.route)); store.dispatch(UpdateCurrentRoute(RecurringExpenseEditScreen.route));
}); });
@ -108,7 +109,7 @@ class RecurringExpenseEditVM extends AbstractExpenseEditVM {
..future.then((_) { ..future.then((_) {
store.dispatch( store.dispatch(
UpdateCurrentRoute(RecurringExpenseEditScreen.route)); UpdateCurrentRoute(RecurringExpenseEditScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity expense) { completer.future.then((SelectableEntity expense) {
store.dispatch(UpdateCurrentRoute(RecurringExpenseEditScreen.route)); store.dispatch(UpdateCurrentRoute(RecurringExpenseEditScreen.route));
}); });

View File

@ -106,7 +106,7 @@ class RecurringInvoiceEditDetailsVM extends EntityEditDetailsVM {
..future.then((_) { ..future.then((_) {
store.dispatch( store.dispatch(
UpdateCurrentRoute(RecurringInvoiceEditScreen.route)); UpdateCurrentRoute(RecurringInvoiceEditScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity client) { completer.future.then((SelectableEntity client) {
store.dispatch(UpdateCurrentRoute(RecurringInvoiceEditScreen.route)); store.dispatch(UpdateCurrentRoute(RecurringInvoiceEditScreen.route));
}); });

View File

@ -73,7 +73,8 @@ class AccountManagementVM {
final companyLength = state.companies.length; final companyLength = state.companies.length;
final deleteCompleter = Completer<Null>() final deleteCompleter = Completer<Null>()
..future.then((value) { ..future
.then((value) {
final context = navigatorKey.currentContext; final context = navigatorKey.currentContext;
final state = store.state; final state = store.state;
if (companyLength == 1) { if (companyLength == 1) {
@ -94,11 +95,12 @@ class AccountManagementVM {
if (Navigator.of(context!).canPop()) { if (Navigator.of(context!).canPop()) {
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
} as FutureOr<_> Function(Null)); } as FutureOr<Null> Function(Null));
store.dispatch( store.dispatch(
RefreshData(clearData: true, completer: refreshCompleter)); RefreshData(clearData: true, completer: refreshCompleter));
} }
} as FutureOr<_> Function(Null)).catchError((Object error) { } as FutureOr<_> Function(Null))
.catchError((Object error) {
if (Navigator.of(navigatorKey.currentContext!).canPop()) { if (Navigator.of(navigatorKey.currentContext!).canPop()) {
Navigator.of(navigatorKey.currentContext!).pop(); Navigator.of(navigatorKey.currentContext!).pop();
} }

View File

@ -83,7 +83,7 @@ class ClientPortalVM {
completer.future.then((value) { completer.future.then((value) {
showRefreshDataDialog( showRefreshDataDialog(
context: navigatorKey.currentContext!); context: navigatorKey.currentContext!);
} as FutureOr<_> Function(Null)); } as FutureOr<Null> Function(Null));
} }
store.dispatch(SaveCompanyRequest( store.dispatch(SaveCompanyRequest(

View File

@ -105,7 +105,7 @@ class InvoiceDesignVM {
showErrorDialog(message: '$error'); showErrorDialog(message: '$error');
}); });
}); });
} as FutureOr<_> Function(Null)); } as FutureOr<Null> Function(Null));
store.dispatch(SaveCompanyRequest( store.dispatch(SaveCompanyRequest(
completer: completer, company: settingsUIState.company)); completer: completer, company: settingsUIState.company));
break; break;

View File

@ -96,7 +96,8 @@ class TemplatesAndRemindersVM {
case EntityType.company: case EntityType.company:
final completer = snackBarCompleter<Null>( final completer = snackBarCompleter<Null>(
context, AppLocalization.of(context)!.savedSettings); context, AppLocalization.of(context)!.savedSettings);
completer.future.then(((value) => callback()) as FutureOr<_> Function(Null)); completer.future.then(
((value) => callback()) as FutureOr<Null> Function(Null));
store.dispatch(SaveCompanyRequest( store.dispatch(SaveCompanyRequest(
completer: completer, company: settingsUIState.company)); completer: completer, company: settingsUIState.company));
break; break;

View File

@ -109,8 +109,8 @@ class UserDetailsVM {
passwordCallback( passwordCallback(
context: context, context: context,
callback: (password, idToken) { callback: (password, idToken) {
final completer = snackBarCompleter<Null>( final completer = snackBarCompleter<Null>(context,
context, AppLocalization.of(context)!.disconnectedEmail); AppLocalization.of(context)!.disconnectedEmail);
store.dispatch( store.dispatch(
DisconnectOAuthMailerRequest( DisconnectOAuthMailerRequest(
user: state.user, user: state.user,
@ -128,8 +128,8 @@ class UserDetailsVM {
passwordCallback( passwordCallback(
context: context, context: context,
callback: (password, idToken) { callback: (password, idToken) {
final completer = snackBarCompleter<Null>( final completer = snackBarCompleter<Null>(context,
context, AppLocalization.of(context)!.disconnectedGmail); AppLocalization.of(context)!.disconnectedGmail);
store.dispatch( store.dispatch(
DisconnectOAuthMailerRequest( DisconnectOAuthMailerRequest(
user: state.user, user: state.user,
@ -178,7 +178,7 @@ class UserDetailsVM {
AppLocalization.of(context)!.disconnectedGoogle); AppLocalization.of(context)!.disconnectedGoogle);
completer.future.then((value) { completer.future.then((value) {
GoogleOAuth.disconnect(); GoogleOAuth.disconnect();
} as FutureOr<_> Function(Null)); } as FutureOr<Null> Function(Null));
store.dispatch( store.dispatch(
DisconnecOAuthUserRequest( DisconnecOAuthUserRequest(
user: state.user, user: state.user,
@ -268,8 +268,8 @@ class UserDetailsVM {
context: context, context: context,
skipOAuth: true, skipOAuth: true,
callback: (password, idToken) { callback: (password, idToken) {
final completer = snackBarCompleter<Null>( final completer = snackBarCompleter<Null>(context,
context, AppLocalization.of(context)!.disconnectedApple); AppLocalization.of(context)!.disconnectedApple);
store.dispatch( store.dispatch(
DisconnecOAuthUserRequest( DisconnecOAuthUserRequest(
user: state.user, user: state.user,
@ -338,7 +338,7 @@ class UserDetailsVM {
} }
appBuilder!.rebuild(); appBuilder!.rebuild();
} as FutureOr<_> Function(Null)); } as FutureOr<Null> Function(Null));
confirmCallback( confirmCallback(
context: context, context: context,

View File

@ -84,7 +84,7 @@ class TaskEditDetailsVM {
cancelCompleter: Completer<Null>() cancelCompleter: Completer<Null>()
..future.then((_) { ..future.then((_) {
store.dispatch(UpdateCurrentRoute(TaskEditDetailsScreen.route)); store.dispatch(UpdateCurrentRoute(TaskEditDetailsScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity client) { completer.future.then((SelectableEntity client) {
store.dispatch(UpdateCurrentRoute(TaskEditDetailsScreen.route)); store.dispatch(UpdateCurrentRoute(TaskEditDetailsScreen.route));
}); });
@ -109,7 +109,7 @@ class TaskEditDetailsVM {
cancelCompleter: Completer<Null>() cancelCompleter: Completer<Null>()
..future.then((_) { ..future.then((_) {
store.dispatch(UpdateCurrentRoute(TaskEditDetailsScreen.route)); store.dispatch(UpdateCurrentRoute(TaskEditDetailsScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity client) { completer.future.then((SelectableEntity client) {
store.dispatch(UpdateCurrentRoute(TaskEditDetailsScreen.route)); store.dispatch(UpdateCurrentRoute(TaskEditDetailsScreen.route));
}); });

View File

@ -112,7 +112,7 @@ class TransactionEditVM {
cancelCompleter: Completer<Null>() cancelCompleter: Completer<Null>()
..future.then((_) { ..future.then((_) {
store.dispatch(UpdateCurrentRoute(TransactionEditScreen.route)); store.dispatch(UpdateCurrentRoute(TransactionEditScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity client) { completer.future.then((SelectableEntity client) {
store.dispatch(UpdateCurrentRoute(TransactionEditScreen.route)); store.dispatch(UpdateCurrentRoute(TransactionEditScreen.route));
}); });

View File

@ -943,8 +943,8 @@ class _MatchWithdrawalsState extends State<_MatchWithdrawals> {
updateExpenseList(); updateExpenseList();
}); });
}, },
placeholder: placeholder: localization!.searchExpenses
localization!.searchExpenses.replaceFirst(':count ', ''), .replaceFirst(':count ', ''),
), ),
), ),
), ),
@ -1112,7 +1112,7 @@ class _MatchWithdrawalsState extends State<_MatchWithdrawals> {
..future.then((_) { ..future.then((_) {
store.dispatch(UpdateCurrentRoute( store.dispatch(UpdateCurrentRoute(
TransactionScreen.route)); TransactionScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity vendor) { completer.future.then((SelectableEntity vendor) {
store.dispatch(SaveTransactionSuccess(transaction store.dispatch(SaveTransactionSuccess(transaction
.rebuild((b) => b..pendingVendorId = vendor.id))); .rebuild((b) => b..pendingVendorId = vendor.id)));
@ -1196,7 +1196,7 @@ class _MatchWithdrawalsState extends State<_MatchWithdrawals> {
..future.then((_) { ..future.then((_) {
store.dispatch(UpdateCurrentRoute( store.dispatch(UpdateCurrentRoute(
TransactionScreen.route)); TransactionScreen.route));
} as FutureOr<_> Function(Null))); } as FutureOr<Null> Function(Null)));
completer.future.then((SelectableEntity category) { completer.future.then((SelectableEntity category) {
store.dispatch(SaveTransactionSuccess( store.dispatch(SaveTransactionSuccess(
transaction.rebuild( transaction.rebuild(