From 2ac5caaf96af0e8c5c48a59a7d6ffc536f21a22a Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 12 Mar 2022 09:42:07 +0100 Subject: [PATCH] Fix a bug on friends list screen --- lib/ui/screens/friends_list_screen.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ui/screens/friends_list_screen.dart b/lib/ui/screens/friends_list_screen.dart index 700ea0c..ed98285 100644 --- a/lib/ui/screens/friends_list_screen.dart +++ b/lib/ui/screens/friends_list_screen.dart @@ -37,8 +37,7 @@ class _FriendsListScreenState extends SafeState { _ErrorsLevel _error = _ErrorsLevel.NONE; FriendsList? _friendsList; late UsersList _usersInfo; - GlobalKey _refreshIndicatorKey = - GlobalKey(); + final _refreshIndicatorKey = GlobalKey(); /// Useful setters set error(_ErrorsLevel err) => setState(() => _error = err); @@ -61,7 +60,10 @@ class _FriendsListScreenState extends SafeState { /// Refresh the list of friends Future _refreshList() async { - await _refreshIndicatorKey.currentState!.show(); + if (_refreshIndicatorKey.currentState != null) + await _refreshIndicatorKey.currentState!.show(); + else + await _getList(); } /// Load the list of friends