diff --git a/lib/widget/refreshable_state.dart b/lib/widget/refreshable_state.dart index 3ea9e5d9..8af4b0ae 100644 --- a/lib/widget/refreshable_state.dart +++ b/lib/widget/refreshable_state.dart @@ -88,8 +88,10 @@ abstract class RefreshableState extends State with return; } + // Refresh the widget - handler for custom request() method Future refresh(BuildContext context) async { + // Escape if the widget is no longer loaded if (!mounted) { return; } @@ -100,6 +102,11 @@ abstract class RefreshableState extends State with await request(context); + // Escape if the widget is no longer loaded + if (!mounted) { + return; + } + setState(() { loading = false; });