authenticator property

Authenticator? get authenticator

The authenticator applied to all outgoing requests, or null for none.

Override this getter to supply an Authenticator. Because it is re-evaluated on every send call, you can change authentication at runtime by pointing it at a mutable field—useful for setting a token after a successful login:

class ApiConnector extends Connector {
  Authenticator? _auth;
  void setToken(String token) => _auth = TokenAuthenticator(token);

  @override
  Authenticator? get authenticator => _auth;
}

Implementation

Authenticator? get authenticator => null;