How do you use Gemini-2.0 Flash exp in Flutter?

I see this error on querying the chat

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: Failed to get response: models/gemini-2.0-flash-exp is not found for API version v1, or is not supported for generateContent. Call ListModels to see the list of available models and their supported methods.

Is there an update for the flutter_gemini package supporting the model that I don’t know about?

1 Like

For Flutter development with Gemini, use the Google AI Dart SDK or Firebase AI Logic SDKs. While prototyping, you can call the Gemini API directly, but for production, use Firebase Vertex AI or server-side calls to protect your API key.

This Flutter sample app showcases how to build a multi-platform application featuring multi-turn conversations (chat) and photo reasoning using multimodal inputs.