GeminiClient constructor
GeminiClient({})
Implementation
GeminiClient({String? apiUrl, String? apiKey, String? model, super.delay, super.logger})
: _dio = Dio(),
_model = model ?? 'gemini-2.0-flash',
_apiUrl = apiUrl ?? 'https://generativelanguage.googleapis.com/v1beta',
_apiKey = apiKey ?? Platform.environment['GEMINI_API_KEY'] ?? '' {
if (_apiKey.isEmpty) {
throw Exception('GEMINI_API_KEY not found in environment variables.');
}
_dio.options.baseUrl = _apiUrl;
_dio.options.headers['Content-Type'] = 'application/json';
_dio.options.headers['X-goog-api-key'] = _apiKey;
}