Before you begin
- Register a QuickBlox account. This is a matter of a few minutes and you will be able to use this account to build your apps.
- Configure QuickBlox SDK for your app. Check out Setup page for more details.
- Create a user session to be able to use QuickBlox functionality. See Authentication page to learn how to do it.
Create user
It’s recommended to manage user creation at your backend for production. To learn more you can refer to QuickBlox API documentation. For POCs/MVPs or during development you may want to create users on the fly, you can usecreateUser() method.
Create a user using the code snippet below. Only login (or email) and password are required. Other fields are optional.
Dart
Retrieve users
Get a list of users using thegetUsers() method. The code snippet below shows how to get a list of users created between the two given dates, sorted in descending order, and limited to 100 users on the page.
Dart
getUsers() accepts two (optional) arguments of the object type that can have the following fields:
If you want to retrieve only users updated after some specific date time, you can use operators. This is useful if you cache users somehow and do not want to obtain the whole list of your users on every app start. Thus, you can use search and sort operators to list users on the page so that it is easier to see specific users.
Search operators
You can use search operators to get more specific search results. The request below will return a list of users with a login other than the one specified.Dart
Sort operators
You can use sort operators to order the search results. The request below will return a list of users with the login sorted in descending order.Dart
Retrieve users by full name
To get a list of users by full name for a current account, user the following code snippet.Dart
Retrieve users by tag
To get a list of users by tag for a current account, use the following code snippet.Dart
Reset user password
This feature is coming soon. Please check back later. For more updates and questions, feel free to contact our Customer Support Team.
Update user
Update a user profile by calling theupdateUser() method. If you want to change your password, you need to provide 2 parameters: password and newPassword. The updated user entity will be returned. You can also update any other field of the user using the updateUser() method. Thus, the snippet below shows how to update a tagList and customData fields.
Dart
Set user avatar
To set a user avatar, just upload a file to the QuickBlox cloud storage and connect it to the user. To upload the file to the QuickBlox cloud storage, call theupload() method and pass the imageFileUrl to it. The imageFileUrl is a path to the file in the device filesystem. Now that the file is uploaded, get the ID of the uploaded file.
To connect the file to the user, set the ID of the uploaded file to the blobId field of the user and call the updateUser() method. As a result, the user avatar gets updated.
Dart
updateUser() method:
Get user avatar
Now, other users can get access to your avatar by calling thegetPrivateURL() method. As a result, you will receive a private URL in the response. See this section to learn more about file URLs.
Dart
Delete user
A user can delete himself from the platform.Dart