Skip to content

Instantly share code, notes, and snippets.

@sendbird-community
Last active April 28, 2021 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sendbird-community/4b7d33383edee670e43cf167ba65469c to your computer and use it in GitHub Desktop.
Save sendbird-community/4b7d33383edee670e43cf167ba65469c to your computer and use it in GitHub Desktop.
Flutter | Get application users
Future<List<User>> getUsers() async {
try {
final query = ApplicationUserListQuery();
List<User> users = await query.loadNext();
return users;
} catch (e) {
print('getUsers: ERROR: $e');
return [];
}
}
@override
void initState() {
super.initState();
getUsers().then((users) {
setState(() {
_availableUsers.clear();
_availableUsers.addAll(users);
});
}).catchError((e) {
print('initState: ERROR: $e');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment