패키지, 저장소 및 앱 카테고리 검색

GitHub 저장소ChunhThanhDe/Flutter_gemini_Chat

Flutter_gemini_Chat

이 저장소는 Flutter_gemini 패키지를 사용하여 Flutter 앱에 Google Gemini를 통합하는 방법에 대한 지침을 제공합니다. 아래는 Flutter를 사용하여 Gemini 챗봇 💬 🤖 AI를 만드는 예제입니다. 지원해 주셔서 감사합니다 ❤️

Flutter_gemini_Chat 프로젝트 이미지
스타
21
포크
1
최근 푸시(UTC)
2025. 3. 1.
프로젝트 상태
활성

원본 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
logo

GitHub stars GitHub forks GitHub watchers

Support me on LinkedIn

Buy Me A Coffee

📚 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

  1. 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.

  2. Add Dependency 📦

    • Add the flutter_gemini package to your project by running:
      flutter pub add flutter_gemini
      
  3. Initialize Gemini ⚙️

    • In your main.dart file, initialize the Gemini package with your API key:
      void main() {
        Gemini.init(apiKey: 'YOUR_API_KEY_HERE');
        runApp(const MyApp());
      }
      
  4. Create an Instance and Make Requests 🤖

    • Use the following code to create an instance of flutter_gemini and handle text or image input:
      final _gemini = Gemini.instance;
      _gemini.textAndImage(
        text: 'Your query here',
        images: [imageFile.readAsBytesSync()],
      );
      
  5. Handle Responses 🔍

    • Manage responses from Gemini with attributes such as FinishReason and SafetyRating:
      if (value?.finishReason != 'STOP') {
        setResponse(value?.output ?? "Invalid User Query");
      }
      if (value?.SafetyRating != 'HarmCategory') {
        setResponse(value?.candidates[0].safety_ratings);
      }
      

🚀 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! 👍

Chung Nguyen Thanh GitHub avatar
GitHub 작성자

Chung Nguyen Thanh ↗

Software Engineer | Flutter & Mobile Developer | AOSP & Embedded Android

VNPT TechnologyVietnam
언어DartSwiftRubyKotlinObjective-C

분류

사용 중인 의존성

의존성 목록 14 개

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗