Customer session


Refresh customer token


This method refreshes the customer’s current token.

This method requires customer authentication.

Note: Returns an error if the customer is not logged in or the token has expired and cannot be refreshed.

Declared In:
lib/modules/client/client_impl.dart

Class:
ClientImpl

Declaration:

Future<void> refreshToken({required void Function() onSuccess, required void Function(SyneriseError) onError}) async

Parameters:

Parameter Type Mandatory Default Description
onSuccess Function() yes - Function to be executed when the operation is completed successfully
onError Function(SyneriseError error) yes - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

await Synerise.client.refreshToken(onSuccess: () {
  //onSuccess handling
}, onError: (SyneriseError error) {
  //onError handling
});

Retrieve customer token


This method retrieves the customer’s current, active token.

This method requires customer authentication.

Note: Returns an error if the customer is not logged in or the token has expired and cannot be refreshed.

Declared In:
lib/modules/client/client_impl.dart

Related To:
Token

Class:
ClientImpl

Declaration:

Future<void> retrieveToken({required void Function(Token) onSuccess, required void Function(SyneriseError) onError}) async

Parameters:

Parameter Type Mandatory Description
onSuccess Function(Token token) yes -
onError Function(SyneriseError error) yes -

Return Value:
No value is returned.

Example:

await Synerise.client.retrieveToken(onSuccess: (Token token) {
  //onSuccess handling
}, onError: (SyneriseError error) {
  //onError handling
});

Get current customer UUID


This method retrieves the customer’s current UUID.

Declared In:
lib/modules/client/client_impl.dart

Class:
ClientImpl

Declaration:

Future<String> getUUID() async

Return Value:
String

Example:

await Synerise.client
        .getUUID()
        .then((result) => {
        //result handling
        });

Regenerate customer


This method regenerates the UUID and clears the authentication token, login session, custom email, and custom identifier.

Note: This operation works only if the customer is anonymous.

Declared In:
lib/modules/client/client_impl.dart

Class:
ClientImpl

Declaration:

Future<void> regenerateUUID() async

Return Value:
No value is returned.

Example:

await Synerise.client
        .regenerateUUID()
        .then((result) => {
        //result handling
        });

Regenerate customer with identifier


This method regenerates the UUID and clears the authentication token, login session, custom email, and custom identifier.

The optional clientIdentifier parameter is a seed for UUID generation.

Note: This operation works only if the customer is anonymous.

Declared In:
lib/modules/client/client_impl.dart

Class:
ClientImpl

Declaration:

Future<void> regenerateUUIDWithClientIdentifier(String clientIdentifier) async

Parameters:

Parameter Type Mandatory Description
clientIdentifier String no Seed for UUID generation
Note: The clientIdentifier parameter is used for decreasing the number of UUID refreshes, so it must be unique for every customer.

Return Value:
No value is returned.

Example:

await Synerise.client
        .regenerateUUIDWithClientIdentifier(clientIdentifier)
        .then((result) => {
        //result handling
        });

Destroy current session


This method destroys the session completely.

This method clears all session data (both client and anonymous) and removes cached data. Then, it regenerates the UUID and creates the new anonymous session.

Declared In:
lib/modules/client/client_impl.dart

Class:
ClientImpl

Declaration:

Future<void> destroySession({required void Function() onSuccess, required void Function(SyneriseError) onError}) async

Parameters:

Parameter Type Mandatory Default Description
onSuccess Function() yes - Function to be executed when the operation is completed successfully
onError Function(SyneriseError error) yes - Function to be executed when the operation is completed with an error

Return Value:
No value is returned.

Example:

await Synerise.client.destroySession(onSuccess: () {
  //onSuccess handling
}, onError: (SyneriseError error) {
  //onError handling
});
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker