Open greatcr7 opened 2 years ago
Have you managed to find a way to do this? I have used a box.listenKey((value) {}); .. but when I try to dispose as per documentation eg: box.removeListen(listen); I get a syntax error telling me that get_storage does not have a function called removeListen ?? please help as now I have set state braking when trying to dispose the widget.
addListener return the dispose function
var dispose = addListener(...
dispose.call() or dispose()
im facing the same issue too...i cant remove the listeners on dispose.
I'm facing the same issue too.
Facing the same issue.
solution:
Function? disposeListen;
@override
void initState() {
GetStorage getStorage = GetStorage();
disposeListen = getStorage.listenKey('my_key', (value) {
//your code here
});
super.initState();
}
@override
void dispose() {
disposeListen?.call();
super.dispose();
}
Trying to remove the listener under dispose but can't....