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:

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

A sample code snippet is shown below:

    
copy
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 2024-09-12 18:16:13 +0530 +0530

ON THIS PAGE