AuthLink class

Simple header-based authentication link that adds headerKey: getToken() to every request.

If a lazy or exception-based authentication link is needed for your use case, implementing your own from the gql reference auth link or opening an issue.

Inheritance

Constructors

Properties

getToken FutureOr<String?> Function()
Authentication callback. Note – must include prefixes, e.g. 'Bearer $token'
final
hashCode int
The hash code for this object.
no setterinherited
headerKey String
Header key to set to the result of getToken
final
requestTransformer → _RequestTransformer
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

concat(Link next) Link
Adds next after this link
inherited
dispose() Future<void>
Can be called to clean up resources
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
request(Request request, [NextLink? forward]) Stream<Response>
A function called when a request reaches this Link
inherited
route(LinkRouter route) Link
Route requests after this link
inherited
split(bool test(Request request), Link left, [Link right = const PassthroughLink()]) Link
Split requests after this link
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

transform(String headerKey, FutureOr<String?> getToken()) → _RequestTransformer