getResultFromException static method

dynamic getResultFromException(
  1. PlatformException e
)

returns an instance of LoginResult class from a PlatformException

Implementation

static getResultFromException(PlatformException e) {
  // CANCELLED, FAILED, OPERATION_IN_PROGRESS
  late LoginStatus status;
  switch (e.code) {
    case "CANCELLED":
      status = LoginStatus.cancelled;
      break;
    case "OPERATION_IN_PROGRESS":
      status = LoginStatus.operationInProgress;
      break;
    default:
      status = LoginStatus.failed;
  }

  return LoginResult(status: status, message: e.message);
}