PermissionService.fromApiKey constructor

PermissionService.fromApiKey([
  1. String? apiKey
])

Creates a PermissionService that does authentication through an API key.

If called without arguments, the API key is taken from these environment variables:

  • GOOGLE_API_KEY
  • GEMINI_API_KEY

Throws ConfigurationException if called without arguments and none of the above environment variables are set. On the web, always throws ConfigurationException if called without arguments.

See API Keys Overview.

Implementation

factory PermissionService.fromApiKey([String? apiKey]) =>
    PermissionService(client: httpClientFromApiKey(apiKey, _apiKeys));