sendOtpRequest function

Future<String?> sendOtpRequest({
  1. required IGraphQlClient graphQlClient,
  2. required String phoneNumber,
})

Sends an otp request. Returns the otp fetched or null if there was an error with request

Implementation

Future<String?> sendOtpRequest({
  required IGraphQlClient graphQlClient,
  required String phoneNumber,
}) async {
  if (phoneNumber.isNotEmpty && phoneNumber != UNKNOWN) {
    final String otp = await GraphQlUtils().sendOtp(
      client: graphQlClient,
      phoneNumber: phoneNumber,
      logTitle: 'Basic details (patient registration) : sendOTP',
    );

    if (otp != 'Error') {
      return otp;
    }

    return null;
  }
  return null;
}