proposal: always_dispose_change_notifier
#58787
Labels
area-devexp
For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.
devexp-linter
Issues with the analyzer's support for the linter package
linter-lint-proposal
linter-status-pending
P3
A lower priority bug or feature request
type-enhancement
A request for a change that isn't a bug
always_dispose_change_notifier
Description
Closing
ChangeNotifier
s prevents memory leaks and unexpected behavior.Details
Closing
ChangeNotifier
s prevents memory leaks and unexpected behavior.Kind
Groups: errors (just as
close_sinks
andcancel_subscriptions
)Good Examples
Bad Examples
Discussion
Since we already have
close_sinks
andcancel_subscriptions
(and evenalways-remove-listener
on dcm) this should be added for Flutter users that instantiateFocusNode
orTextEditingController
(both areChangeNotifier
) for example. Since the good practice is disposing it inside the current scope that should be just fine.Mentioned here: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#be-explicit-about-dispose-and-the-object-lifecycle
Discussion checklist
The text was updated successfully, but these errors were encountered: