Now Google Gemini is all set for Flutter

Padmaja Bodsakurthi
2 min readJan 23, 2024

--

Stay tuned! Have you ever imagined creating applications that can comprehend and interact with users in a genuinely human-like manner? Google Gemini, an advanced AI model, is now available to turn that dream into reality! Enhance your app with its capabilities using the potent google_gemini package for Flutter.

What is Google Gemini?

Google Gemini is an advanced artificial intelligence model that goes beyond traditional text-based capabilities. It excels in generating creative text formats, analyzing images, and understanding user intent. Gemini is a multimodal powerhouse, meaning it can seamlessly handle various types of data such as text, images, audio, and even code. This versatility opens up a realm of possibilities for developing innovative and engaging applications that extend beyond the limitations of conventional chatbots.

Getting Started

Ready to embark on your Gemini adventure? LET’S GO

  1. Install the google_gemini package
flutter pub add google_gemini

2. Get the Gemini api_key from ai.google.dev

3. Create Gemini Instance

final gemini = GoogleGemini(
apiKey: "--- Your Gemini Api Key --- ",
);

4. Text-only input

This feature lets you perform natural language processing (NLP) tasks such as text completion and summarization.

gemini.generateFromText("Tell me a story")
.then((value) => print(value.text))
.catchError((e) => print(e));

5. Text and image input

You can send a text prompt with an image to the Gemini-pro-vision model to perform a vision-related task. For example, you are captioning an image or identifying what’s in an image.

File image = File("assets/images.png")
gemini.generateFromTextAndImages(
query: "What is this picture?",
image: image
)
.then((value) => print(value.text))
.catchError((e) => print(e));

Google Gemini offers a range of capabilities to enhance your experience:

  1. Answering Questions: Gemini has the ability to tackle intricate subjects, grasp the context of your inquiries, and furnish informative and insightful responses.
  2. Language Translation: Effortlessly translate content between languages while maintaining the subtleties and intent of the original text.
  3. Information Summarization: Streamline lengthy articles or documents by condensing them into concise summaries, saving you time and simplifying the consumption of information.

--

--