for(i= 0; i< 6 ; i++)
Pinput(length: 6,controller: model.otpController[i],
focusNode:focusNode,
androidSmsAutofillMethod:AndroidSmsAutofillMethod.smsUserConsentApi,
listenForMultipleSmsOnAndroid: true,
defaultPinTheme: defaultPinTheme,
hapticFeedbackType: HapticFeedbackType.lightImpact,
onCompleted: (pin) {debugPrint('onCompleted: $pin');},
onChanged: (value) {debugPrint('onChanged: $value');},
I try to count the number of wrong otp attempts , so i use for loop and int otpContrller[i] Please try to resolve this issue
Try this for full OTP attempts:
int attempts = 0;
Pinput(
onCompleted: (pin) {
String actualPin = '9999';
if (pin == actualPin) {
attempts = 0;
print('success');
return;
} else {
print('failed');
setState(() {
attempts += 1;
});
}
print(pin);
},
),
Text('No of Attempts $attempts'),