Unhandled Exception: 'package:flutter/src/widgets/scroll_controller.dart': Failed assertion: line 152 pos 12: '_positions.isNotEmpty': ScrollController not attached to any scroll views.
To avoid such type of errors check if exist
if (_scrollController.hasClients) {
_scrollController.animateTo(0.0, curve: Curves.easeOut, duration: const Duration(milliseconds: 300))
}
If this is false, then members that interact with the [ScrollPosition], such as
[position], [offset], [animateTo], and [jumpTo], must not be called.