otp_textfield
otp_textfield copied to clipboard
Unable to ts set numberOfFields to 6
Am failing to set numberOfFields prop to 6. This is the error am getting: RangeError (index): Invalid value: Not in inclusive range 0..4: 5
I had the same issue.
If you don`t want to use different text styles for each field than comment this if statement in Widget generateTextFields in the flutter_otp_text_field.dart. After this you should be able to use more than 5 fields.
/* if (widget.styles.length > 0) {
return _buildTextField(
context: context,
index: i,
style: widget.styles[i],
);
} */
Wrapping with Flexible() worked for me!