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
692 stars 338 forks source link

Unexpected error: setState() called after dispose() #244

Closed zooRg closed 2 years ago

zooRg commented 2 years ago
I/flutter ( 6344): │ ⛔ Unexpected error: setState() called after dispose(): _PinCodeTextFieldState#2283f(lifecycle state: defunct, not mounted, tickers: tracking 0 tickers)
I/flutter ( 6344): │ ⛔ This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.
I/flutter ( 6344): │ ⛔ The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
I/flutter ( 6344): │ ⛔ This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().
I/flutter ( 6344): │ ⛔ #0      State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1085:9)
I/flutter ( 6344): │ ⛔ #1      State.setState (package:flutter/src/widgets/framework.dart:1120:6)
I/flutter ( 6344): │ ⛔ #2      _PinCodeTextFieldState.initState.<anonymous closure> (package:pin_code_fields/src/pin_code_fields.dart:322:7)
I/flutter ( 6344): │ ⛔ #3      ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:308:24)
I/flutter ( 6344): │ ⛔ #4      FocusNode._notify (package:flutter/src/widgets/focus_manager.dart:977:5)
I/flutter ( 6344): │ ⛔ #5      FocusManager._applyFocusChange (package:flutter/src/widgets/focus_manager.dart:1715:12)
I/flutter ( 6344): │ ⛔ #6      _rootRun (dart:async/zone.dart:1418:47)
I/flutter ( 6344): │ ⛔ #7      _CustomZone.run (dart:async/zone.dart:1328:19)
I/flutter ( 6344): │ ⛔ #8      _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
I/flutter ( 6344): │ ⛔ #9      _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
I/flutter ( 6344): │ ⛔ #10     _rootRun (dart:async/zone.dart:1426:13)
I/flutter ( 6344): │ ⛔ #11     _CustomZone.run (dart:async/zone.dart:1328:19)
I/flutter ( 6344): │ ⛔ #12     _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
I/flutter ( 6344): │ ⛔ #13     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1276:23)
I/flutter ( 6344): │ ⛔ #14     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
I/flutter ( 6344): │ ⛔ #15     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
I/flutter ( 6344): │ ⛔ 
adar2378 commented 2 years ago

I believe this has been fixed in the new update.