sendOtp method

Future<bool> sendOtp()

Implementation

Future<bool> sendOtp()async{
  var data = json.encode({
    "phone": phoneNumberController.text,
    "countryCode": countryCodeController.text
  });

  var response = await Requests.getDio().post('/auth/send-otp',
    data: data,
  );

  if (response.statusCode == 200) {
    return true;
  }
  else {
    print(response.statusCode.toString() + response.data["message"]);
    CustomFlashWidget.showFlashMessage(title: "Error",type: FlashType.error,
        message: "We were not able to send otp. "+response.data["message"]);
    return false;
  }
}