Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds dispose to TextEditingController #446

Merged
merged 2 commits into from
Mar 29, 2024

Conversation

vicenterusso
Copy link
Contributor

Fixes #445

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest you only dispose only if the controller is not provided in the widget.

Just simply add

if (widget.textController == null) {
  //
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, inside _ReactiveTextFieldState class, textController is not nullable

Copy link
Contributor

@remonke remonke Mar 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

widget refers to the widget, ya know, this thing extending the StatefulWidget class, not State. In initState you either use textController from this widget or initialize it. I suggest you only dispose the one initialized in the state, and if it's externally provided, leave it alone.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes total sense!

@joanpablo
Copy link
Owner

Hi @vicenterusso, thanks for the contribution.
It seems to be an issue with the patch though, can you check what is failing before I can take a look? Thanks in advance.

@joanpablo joanpablo merged commit 18243cf into joanpablo:master Mar 29, 2024
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReactiveTextField doesn't dispose the TextEditingController
3 participants