exitInstaFido function

dynamic exitInstaFido({
  1. required BuildContext context,
  2. required String exitStatus,
  3. required String scanId,
  4. required String msg,
})

Implementation

exitInstaFido(
    {required BuildContext context,
    required String exitStatus,
    required String scanId,
    required String msg}) {
  var data1 = {"status": Status.failed, "message": ExitMessage.invalidToken};
  var data2 = {"status": Status.failed, "message": ExitMessage.networkError};
  switch (exitStatus) {
    case "docTokenFailed":
      Navigator.pop(context, data1);
      break;
    case "countryTokenFailed":
      Navigator.pop(context);
      Navigator.pop(context, data1);
      break;
    case "docNetworkError":
      Navigator.pop(context, data2);
      break;
    case "countryNetworkError":
      Navigator.pop(context);
      Navigator.pop(context, data2);
      break;
    case "submitScanApiFailure":
      Navigator.pop(context);
      Navigator.pop(context, data2);

      break;
    case "submitLivelinessApiFailure":
      Navigator.pop(context);
      Navigator.pop(context);
      Navigator.pop(context, data2);
      break;
    case "SuccessDone":
      var data = {
        "status": Status.success,
        "scanId": scanId,
        "message": ExitMessage.completed
      };
      Navigator.pop(context);
      Navigator.pop(context);
      Navigator.pop(context, data);
      break;
  }
}