This plugin calls .dispose() on the ScrollController argument it receives.
This means the obvious usage pattern is now wrong:
class _MyWidgetState extends State<MyWidget> {
ScrollController _myController;
@override
void initState() {
super.initState();
_myController = ScrollController();
}
@override
void dispose() {
// Wrong, because this plugin wants me *not* to dispose my own controller!
_myController.dispose();
super.dispose();
}
@override
Widget build() {
return FadingEdgeScrollView.fromScrollView(child: ... _myController ...);
}
}
This is surprising: If I'm supposed to create the controller and pass it in, it should also be my job to dispose it. This is the way it works everywhere else in Flutter.
So, I think you should not dispose the controller and let the user control its lifetime instead. This user ran into the same problem and would probably agree.
This plugin calls
.dispose()
on the ScrollController argument it receives.This means the obvious usage pattern is now wrong:
This is surprising: If I'm supposed to create the controller and pass it in, it should also be my job to dispose it. This is the way it works everywhere else in Flutter.
So, I think you should not dispose the controller and let the user control its lifetime instead. This user ran into the same problem and would probably agree.
Thank you!