Generative AI with Flutter demonstrates Google's Generative AI on Flutter with Stream Chat SDK for Flutter.
The purpose of this repository is to demonstrate below:
- Demonstrates Gemini API for Flutter.
- Integrating chat systems with Stream Chat Flutter SDK for real-time event handling.
- Examples for all current capabilities of the google_generative_ai package.
If you're interested in knowing more about Google's Generative AI SDK, check out the following blog post: Generative AI with Flutter
Generative AI with Flutter is built with Stream Chat SDK for Flutter to implement messaging systems. If you’re interested in building powerful real-time video/audio calling, audio room, and livestreaming, check out the Stream Video SDK for Flutter!
To build this project properly, you should follow the instructions below:
- Go to the Stream login page.
- If you have your GitHub account, click the SIGN UP WITH GITHUB button and you can sign up within a couple of seconds.
- If you don't have a GitHub account, fill in the inputs and click the START FREE TRIAL button.
- Go to the Dashboard and click the Create App button like the below.
- Fill in the blanks like the below and click the Create App button.
- You will see the Key like the image below and then copy it.
- Add the key you just retrieved to the
lib/data/config.dart
file:
class GenAIConfig {
static String streamApiKey = "YOUR_STREAM_API_KEY";
// ...
}
-
Go to your Dashboard again and click your App.
-
In the Overview menu, you can find the Authentication category by scrolling to the middle of the page.
-
Switch on the Disable Auth Checks option and click the Submit button like the image below.
-
Click the Explorer tab on the left side menu.
-
Click users -> Create New User button sequentially and add fill in the user like the below:
- User Name:
gemini
- User ID:
gemini
- Go to Google AI Studio, login with your Google account and select the Get API key on the menu left like the image below:
- Create your API key for using generative AI SDKs, and you'll get one like the image below:
- Add the second key you just retrieved to the
lib/data/config.dart
file:
class GenAIConfig {
// ...
static String geminiApiKey = "YOUR_GEMINI_API_KEY";
}
- Build and run the project.