always-remove-getx-listener
Warns when a GetX event listener is added but never removed.
Example
❌ Bad:
class VideoViewerController extends GetxController {
final _someListener = Listener();
final _anotherListener = Listener();
void onInit() {
_someListener.addListener(listener);
_anotherListener.addListener(listener); // LINT
}
void onClose() {
_someListener.removeListener(listener);
}
void listener() {
...
};
}
✅ Good:
class VideoViewerController extends GetxController {
final _someListener = Listener();
final _anotherListener = Listener();
void onInit() {
_someListener.addListener(listener);
_anotherListener.addListener(listener);
}
void onClose() {
_someListener.removeListener(listener);
_anotherListener.removeListener(listener);
}
void listener() {
...
};
}