gemini_chatbot 0.0.2
gemini_chatbot: ^0.0.2 copied to clipboard
Gemini Chatbot is a Flutter package that integrates Google Gemini AI to create an AI-powered chatbot.use predefined trained responses, and easily integrate the chatbot into their applications.
import 'package:flutter/material.dart';
import 'package:gemini_chatbot/gemini_chatbot.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: ChatbotScreen(),
);
}
}
class ChatbotScreen extends StatefulWidget {
const ChatbotScreen({super.key});
@override
State<ChatbotScreen> createState() => _ChatbotScreenState();
}
class _ChatbotScreenState extends State<ChatbotScreen> {
@override
Widget build(BuildContext context) {
final String apiKey = "YOUR_GEMINI_API_KEY"; // Replace with a real API key
final Map<String, String> trainedData = {
"Hello": "Hi! How can I help you?",
"What is Flutter?": "Flutter is an open-source UI toolkit by Google.",
"How do I use this chatbot?":
"Just type your question and get a response.",
};
return Scaffold(
appBar: AppBar(title: Text("Gemini AI Chatbot")),
body: GeminiChatbot(apiKey: apiKey, trainedData: trainedData),
);
}
}