localLogin method

Future<void> localLogin()

Implementation

Future<void> localLogin() async {
  var localLogin = await widget.transition.localLogin();

  if (localLogin) {
    var storage = new FlutterSecureStorage();
    widget.modelCallback().email = await storage.read(key: 'localLoginEmail');
    widget.modelCallback().password =
        await storage.read(key: 'localLoginPassword');
    await widget.transition.login(
      context: context,
      image: 'assets/' + _mojo.loadingImage(),
      text: 'LOADING DETAILS...',
      onSuccess: () async {
        await widget.onLoginSuccess(context);
      },
      onFail: ({error, required result}) async {
        widget.transition.disableLocalLogin();
        await DialogHelper.showFailure(
            context: context,
            result: MojoResult(resultType: ResultType.LocalLoginFailed));
      },
    );
  }
}