setToken method

void setToken(
  1. String token, {
  2. String prefix = 'Bearer',
})
override

Sets the authentication token for API requests.

This method sets a token globally for all subsequent API requests made through the Fetchly library. The token can be prefixed with a specified string (default: 'Bearer').

Example:

apiServices.setToken('your-token-here');

token: The authentication token to be used. prefix: An optional prefix for the token (default: 'Bearer').

Implementation

void setToken(String token, {String prefix = 'Bearer'}) {
  Fetchly.setToken(token, prefix: prefix);
}