Does autoDispose in Riverpod's StateProvider disposes controllers? Does both the following statements works similarly?
final _controller = StateProvider.autoDispose((ref) => PageController());
or
final _controller = PageController();
@override
void dispose() {
_controller.dispose();
super.dispose();
}
autoDispose modifier, as the name suggests, disposes call of the resources when the provider is not used, it simply frees up memory without us specifying any dispose function.
One example that may help you for example when you navigate into another page in which you have a provider with autoDispose, if you go back to your first page your provider data will reset, without autoDispose, everything will be saved.