Flutter_gemini_Chat
このリポジトリでは、Flutter_gemini パッケージを使用して Flutter アプリに Google Gemini を統合する手順を提供しています。以下は、Flutter を使用して Gemini チャットボット 💬 🤖 AI を作成する例です。ご支援ありがとうございます ❤️
- スター
- 21
- フォーク
- 1
- 最終プッシュ(UTC)
- 2025/03/01
- プロジェクト状態
- 公開中
元の README
以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。
🚀 Integrating Gemini into Your Flutter Application
Create gemini robot 💬 chat bot 🤖 with Flutter. Show some ❤️ and star ⭐ the repo if you liked it.
contact for work, mail: chunhthanhde.dev@gmail.com
📚 Overview
Integrate Google's Gemini AI into your Flutter app with ease using the flutter_gemini package. This guide will help you enhance your app's functionality by leveraging Gemini's advanced AI features, including multilingual support, image and audio processing, and Natural Language Processing (NLP).
🌟 Key Features of Gemini
- Stream Generate Content: Handle partial results with streaming without waiting for the complete response.
- Text-only Input: Complete and summarize texts using NLP.
- Text-and-Image Input: Use the gemini-pro-vision model for tasks involving both text and images.
- Multi-Turn Conversations (Chat): Engage in dynamic conversations with follow-up questions.
- Token Counting: Convert information into floating-point numbers.
- Model Info: Retrieve details about the model, including version and input token limits.
- EmbedContents and BatchEmbedContents: Transform information into numerical arrays for learning.
🏁 Implementation Steps
-
Obtain an API Key 🔑 Create an account at Google Gemini.
-
Click on "Get API Key,"
-
select a Google Cloud project,
-
and generate your API key.
-
Save this key for later use.
-
-
Add Dependency 📦
- Add the
flutter_geminipackage to your project by running:flutter pub add flutter_gemini
- Add the
-
Initialize Gemini ⚙️
- In your
main.dartfile, initialize the Gemini package with your API key:void main() { Gemini.init(apiKey: 'YOUR_API_KEY_HERE'); runApp(const MyApp()); }
- In your
-
Create an Instance and Make Requests 🤖
- Use the following code to create an instance of
flutter_geminiand handle text or image input:final _gemini = Gemini.instance; _gemini.textAndImage( text: 'Your query here', images: [imageFile.readAsBytesSync()], );
- Use the following code to create an instance of
-
Handle Responses 🔍
- Manage responses from Gemini with attributes such as
FinishReasonandSafetyRating:if (value?.finishReason != 'STOP') { setResponse(value?.output ?? "Invalid User Query"); } if (value?.SafetyRating != 'HarmCategory') { setResponse(value?.candidates[0].safety_ratings); }
- Manage responses from Gemini with attributes such as
🚀 Demo
You can see the response from the gemini here: https://www.youtube.com/watch?v=SUzw8YPLYZM
![]() |
![]() |
🎉 Benefits
- Easy Integration: Simplifies adding AI features with clear documentation.
- Cross-Platform Compatibility: Supports Android, iOS, web, macOS, and Windows from a single codebase.
- Reduced Time to Market: Speeds up the integration of AI features into your app.
🌟 Conclusion
Integrating Google Gemini into your Flutter app with the flutter_gemini package opens up new possibilities for enhancing user experience. Utilize Gemini's powerful AI capabilities to add multilingual support, process images and audio, and implement advanced chatbot functionality.
📚 References
Feel free to like and share your thoughts in the comments if you found this guide helpful! 👍
カテゴリー
使用している依存関係
依存関係一覧 14 件
- flutter
{"sdk":"flutter"} - cupertino_icons
^1.0.6 - provider
^6.1.2 - get_it
^7.6.7 - dio
^5.4.1 - image_picker
^1.0.7 - flutter_markdown
^0.6.21 - emoji_picker_flutter
^2.1.0 - loading_animation_widget
^1.2.1 - image_picker_ios
^0.8.9+2 - flutter_gemini
^2.0.3 - url_launcher
^6.3.0 - flutter_test開発用
{"sdk":"flutter"} - flutter_launcher_icons開発用
0.13.1
プロジェクトに合うリポジトリを選ぶには?
用途で絞り込み、開発状況を比較し、採用前に元のリポジトリで要件を確認しましょう。
- 名前・作者・説明で検索し、技術トピックで絞り込みます。
- スター、フォーク、最近のプッシュを比較します。スターは関心の目安であり、品質の保証ではありません。
- 利用前に GitHub で README、ライセンス、Issues を確認します。
情報源と管理
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗







