ApiKeyProvider class
Simple API key provider with static credentials.
This provider returns the same API key on every call to getCredentials. It's suitable for use cases where the API key doesn't expire.
Example:
final client = GoogleAIClient(
config: GoogleAIConfig(
authProvider: ApiKeyProvider('YOUR_API_KEY'),
),
);
- Implemented types
Constructors
- ApiKeyProvider(String apiKey, {AuthPlacement placement = AuthPlacement.queryParam})
-
Creates an ApiKeyProvider.
const
Properties
- apiKey → String
-
The API key to use for authentication.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- placement → AuthPlacement
-
Where to place the API key (query param or header).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getCredentials(
) → Future< AuthCredentials> -
Retrieves authentication credentials.
override
-
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