Authenticator class abstract

Contract for all authentication strategies in Lucky Dart.

Implement this interface to create a custom authenticator and attach it to a Connector by passing an instance to the connector's auth field. The apply method is called with the outgoing request's Options just before the request is dispatched, allowing the implementation to inject credentials in any form (header, query parameter, etc.).

class MyAuthenticator implements Authenticator {
  @override
  void apply(Options options) {
    options.headers ??= {};
    options.headers!['X-My-Token'] = 'secret';
  }
}
Implementers

Constructors

Authenticator()
Creates an Authenticator.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

apply(Options options) → void
Applies authentication credentials to the outgoing request options.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited