You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior:
Should be able to update the date when hitting okay
Current behavior:
Throws an error related to dispose and setState
Steps to reproduce
Click on field to change the date.
Change date
Tap okay
Debugger highlights this code from the _FormBuilderDateTimePickerState
@overridevoiddispose() {
effectiveFocusNode.removeListener(_handleFocus);
// Dispose the _textFieldController when initState created itif (null== widget.controller) {
_textFieldController.dispose();
}
super.dispose();
}
Future<void> _handleFocus() async {
if (effectiveFocusNode.hasFocus && enabled) {
effectiveFocusNode.unfocus();
awaitonShowPicker(context, value); // <<<----- HERE
}
}
Stacktrace/Logcat
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.
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.
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().
#0 State.setState.<anonymous closure>
package:flutter/…/widgets/framework.dart:1097
#1 State.setState
package:flutter/…/widgets/framework.dart:1132
#2 FormFieldState.didChange
package:flutter/…/widgets/form.dart:459
#3 FormBuilderFieldState.didChange
package:flutter_form_builder/src/form_builder_field.dart:201
#4 _FormBuilderDateTimePickerState.didChange
package:flutter_form_builder/…/fields/form_builder_date_time_picker.dart:388
#5 _FormBuilderDateTimePickerState.onShowPicker
package:flutter_form_builder/…/fields/form_builder_date_time_picker.dart:312
<asynchronous suspension>
#6 _FormBuilderDateTimePickerState._handleFocus
package:flutter_form_builder/…/fields/form_builder_date_time_picker.dart:271
<asynchronous suspension>```
The text was updated successfully, but these errors were encountered:
Environment
Package version: 7.8.0
Flutter doctor
Code sample
Description
Expected behavior:
Should be able to update the date when hitting okay
Current behavior:
Throws an error related to dispose and setState
Steps to reproduce
Debugger highlights this code from the _FormBuilderDateTimePickerState
Stacktrace/Logcat
The text was updated successfully, but these errors were encountered: