QueryAuthenticator class

Authenticator that passes an API key as a URL query parameter.

Because Dio's Options object does not carry query parameters (they live on RequestOptions after the request is built), apply is intentionally a no-op. Instead, call toQueryMap and merge the result into the connector's default query parameters so that Lucky's ConfigMerger can include the key in every outgoing URL.

class MyConnector extends Connector {
  final _auth = QueryAuthenticator('api_key', 'abc123');

  @override
  Map<String, dynamic>? defaultQuery() => _auth.toQueryMap();
}
Implemented types

Constructors

QueryAuthenticator(String key, String value)
Creates a QueryAuthenticator with the given query parameter key and value.

Properties

hashCode → int
The hash code for this object.
no setterinherited
key → String
The query parameter name used to transmit the API key (e.g. 'api_key').
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
value → String
The API key value to include in the query string.
final

Methods

apply(Options options) → void
No-op implementation required by the Authenticator interface.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toQueryMap() → Map<String, String>
Returns a single-entry map suitable for merging into Connector.defaultQuery().
toString() → String
A string representation of this object.
inherited

Operators

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