adar2378 / pin_code_fields

A flutter package which will help you to generate pin code fields with beautiful design and animations. Can be useful for OTP or pin code inputs 🤓🤓
https://pub.dev/packages/pin_code_fields
MIT License
690 stars 336 forks source link

The following assertion was thrown while dispatching notifications for FocusNode #292

Closed bambinoua closed 1 year ago

bambinoua commented 1 year ago

The following assertion was thrown while dispatching notifications for FocusNode:

setState() called after dispose(): _PinCodeTextFieldState#8937e(...)

The issue occurred in a line 336 (method initState) of pin_code_fields.dart file.

@overide
void initState() {
  super.initState();
  ...
  _focusNode!.addListener(() {
    setState((){}); // <-- line 336
  });
  ...
}
Karlen96 commented 1 year ago

the focusNode is being disposed twice: once during navigation and once again from outside. The package has an "automatic dispose" feature, that can be set to false for manual disposal.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.