saveSettingsOTP function

Future<String?> saveSettingsOTP(
  1. String _otpPrefix,
  2. String _otpNumber,
  3. String _twilioAccountSID,
  4. String _twilioAuthToken,
  5. String _twilioServiceId,
  6. dynamic _nexmoFrom,
  7. dynamic _nexmoText,
  8. dynamic _nexmoApiKey,
  9. dynamic _nexmoApiSecret,
  10. dynamic _sMSToFrom,
  11. dynamic _sMSToText,
  12. dynamic _sMSToApiKey,
)

Implementation

Future<String?> saveSettingsOTP(String _otpPrefix, String _otpNumber,
    String _twilioAccountSID, String _twilioAuthToken, String _twilioServiceId,
    _nexmoFrom, _nexmoText, _nexmoApiKey, _nexmoApiSecret, _sMSToFrom,
    _sMSToText, _sMSToApiKey) async{

  appSettings.otpPrefix = _otpPrefix;
  appSettings.otpNumber = int.parse(_otpNumber);
  appSettings.twilioAccountSID = _twilioAccountSID;
  appSettings.twilioAuthToken = _twilioAuthToken;
  appSettings.twilioServiceId = _twilioServiceId;
  // nexmo
  appSettings.nexmoFrom = _nexmoFrom;
  appSettings.nexmoText = _nexmoText;
  appSettings.nexmoApiKey = _nexmoApiKey;
  appSettings.nexmoApiSecret = _nexmoApiSecret;
  // sms.to
  appSettings.smsToFrom = _sMSToFrom;
  appSettings.smsToText = _sMSToText;
  appSettings.smsToApiKey = _sMSToApiKey;
  var _data = {
    "otpEnable": appSettings.otpEnable,
    "otpPrefix": appSettings.otpPrefix,
    "otpNumber": appSettings.otpNumber,
    "otpTwilioEnable": appSettings.otpTwilioEnable,
    "twilioAccountSID": appSettings.twilioAccountSID,
    "twilioAuthToken": appSettings.twilioAuthToken,
    "twilioServiceId": appSettings.twilioServiceId,
    // nexmo
    "otpNexmoEnable" : appSettings.otpNexmoEnable,
    "nexmoFrom" : appSettings.nexmoFrom,
    "nexmoText" : appSettings.nexmoText,
    "nexmoApiKey" : appSettings.nexmoApiKey,
    "nexmoApiSecret" : appSettings.nexmoApiSecret,
    // sms.to
    "otpSMSToEnable" : appSettings.otpSMSToEnable,
    "smsToFrom" : appSettings.smsToFrom,
    "smsToText" : appSettings.smsToText,
    "smsToApiKey" : appSettings.smsToApiKey,
  };
  try{
    await dbSetDocumentInTable("settings", "main", _data);
  }catch(ex){
    return "saveSettingsOTP " + ex.toString();
  }
  return null;
}