Get Current User

You can obtain the details of the current end user of your application by calling the getCurrentUser() method. Upon successful execution, this method will return the current user object. You can fetch the user’s details that are registered in Catalyst, such as their first name, last name, or email address, using this.

The code syntax for obtaining the current user is given below:

ZCatalystApp.getInstance().getCurrentUser( void Function() onSuccess, void Function(ZCatalystException) onFailed )

A sample code snippet is shown below:

ZCatalystApp.getInstance().getCurrentUser( onSuccess: (APIResponse response, ZCatalystUser user) { print('The current user is ${user.firstName}'); //Actions to be executed upon successfully fetching user details }, onFailed: (ZCatalystException exception) { print('Exception thrown: $exception'); //Actions to be executed upon a failed state });

Last Updated 2023-09-03 01:06:41 +0530 +0530