flutter_hooks icon indicating copy to clipboard operation
flutter_hooks copied to clipboard

Documentation of useTextEditingController with useEffect needs to be updated

Open AhmedLSayed9 opened this issue 3 years ago • 0 comments
trafficstars

Hello,

The doc of useTextEditingController suggests using useEffect to update the TextEditingController.text whenever a provided ValueListenable changes.

But, When the provided ValueListenable updates the TextEditingController.text for the second time it'll throw an exception: setState() or markNeedsBuild() called during build

Suggestion: Delaying the update by a frame using Future.microtask inside useEffect fixes the issue.

AhmedLSayed9 avatar Aug 19 '22 13:08 AhmedLSayed9