This is a test project using the Gemini AI with Flutter.
To use this project, you need to have the Flutter SDK installed. You can find the installation instructions.
To use the Gemini AI, you need to have an API key. Get an API Key.
To add your API key to the project, you have to add it to pass it to the flutter run command:
flutter run --dart-define=API_KEY=$YOUR_API_KEY
Replace $YOUR_API_KEY with your API key.
You can set your IDE's run configuration to pass the API key.
- Open the project in Android Studio.
- Click on the
main.dart
dropdown at the top of the window. - Click on
Edit Configurations...
. - In the
Additional run args
field, add--dart-define=API_KEY=YOUR_API_KEY
- Click on
Apply
andOK
.
Your configuration should look like this:
- Open the project in VS Code.
- Click on
Run and Debug
from the left sidebar. - Click on
create a launch.json file
. - Select
Dart & Flutter
. - Add
"args": ["--dart-define=API_KEY=YOUR_API_KEY"]
in the first configuration object. - Save the file.
Your file should look like this:
To learn more about this project with in-depth explanations, check out these links:
- AI with Flutter and Dart: boost your applications with Gemini
- IA avec Flutter et Dart: boostez vos applications avec Gemini
To see the complete demo, check out this video: