AutoClose-GetX
This is a part of AutoClose package: You should first visit this link to become familiar with the key concepts of this library..
This library provides functionality of AutoClose package for GetX classes.
Getting started
flutter pub add autoclose_getx
# optional, but I insist on giving it a chance
flutter pub add autoclose_lint
Usage
class ProfileEditingController extends GetxController with CloserGetx {
final UserRepository userRepository;
ProfileEditingController({
required this.userRepository,
});
@override
void onInit() {
super.onInit();
userRepository.userAuthTokenStream.listen((token) {
// ... handle token update
})
// CloserGetx mixin provides `closeWith` functionality
// so subscriptions/resources get canceled in onClose().
.closeWith(this);
}
}