proposal: always_dispose_change_notifier
#58787
Labels
analyzer-linter
Issues with the analyzer's support for the linter package
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
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: