setAuthToken static method

void setAuthToken(
  1. String token
)

Sets the Authorization: Bearer <token> header on all subsequent requests.

Call this immediately after a successful login — no re-initialisation needed.

final token = await authRepo.login(username, password);
NetworkService.setAuthToken(token);

Implementation

static void setAuthToken(String token) {
  _apiManager.updateHeaders({'Authorization': 'Bearer $token'});
}