Skip to content

Commit 8c2c829

Browse files
committed
bug fixed on verification ID
1 parent 9f99634 commit 8c2c829

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/Service/Auth_Service.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class AuthClass {
5050
}
5151

5252
Future<String> veryfyPhoneNuber(
53-
String phoneNumber, BuildContext context) async {
53+
String phoneNumber, BuildContext context, Function startTimer) async {
5454
print(phoneNumber);
5555
String verificationId = "";
5656
PhoneVerificationCompleted verificationCompleted =
@@ -60,19 +60,18 @@ class AuthClass {
6060
};
6161
PhoneVerificationFailed verificationFailed =
6262
(FirebaseAuthException authException) {
63-
verificationId = verificationId;
6463
showSnackBar(
6564
context, "Sorry we are not able to verify your phone Number");
6665
};
6766
PhoneCodeSent codeSent =
6867
(String verificationId, [int forceResendingToken]) async {
69-
verificationId = verificationId;
7068
showSnackBar(context, "code have sent to your number");
69+
startTimer(verificationId);
7170
};
7271
PhoneCodeAutoRetrievalTimeout codeAutoRetrievalTimeout =
7372
(String verificationId) {
74-
verificationId = verificationId;
7573
showSnackBar(context, "Timeout");
74+
return verificationId;
7675
};
7776
try {
7877
await auth.verifyPhoneNumber(

lib/pages/PhoneAuthPage.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ class _PhoneAuthPageState extends State<PhoneAuthPage> {
120120
);
121121
}
122122

123-
void startTimer() {
123+
void startTimer(String verficationId) {
124+
print("--------------------->>>>>>>");
125+
print(verficationId);
124126
const onsec = Duration(seconds: 1);
125127
Timer _timer = Timer.periodic(onsec, (timer) {
126128
if (start == 0) {
@@ -186,14 +188,13 @@ class _PhoneAuthPageState extends State<PhoneAuthPage> {
186188
onTap: wait
187189
? null
188190
: () async {
189-
startTimer();
190191
setState(() {
191192
start = 30;
192193
wait = true;
193194
buttonName = "Resend";
194195
});
195196
await authClass.veryfyPhoneNuber(
196-
"+91 ${_phoneController.text}", context);
197+
"+91 ${_phoneController.text}", context, startTimer);
197198
},
198199
child: Padding(
199200
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 15),

0 commit comments

Comments
 (0)