flutter_ai_toolkit 0.1.4 flutter_ai_toolkit: ^0.1.4 copied to clipboard
A set of AI chat-related widgets for your Flutter app targeting mobile, desktop and web.
// Copyright 2024 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_ai_toolkit/flutter_ai_toolkit.dart';
import 'package:google_generative_ai/google_generative_ai.dart';
import '../gemini_api_key.dart';
void main(List<String> args) async => runApp(const App());
class App extends StatelessWidget {
static const title = 'Example: Google Gemini AI';
const App({super.key});
@override
Widget build(BuildContext context) => const MaterialApp(
title: title,
home: ChatPage(),
);
}
class ChatPage extends StatelessWidget {
const ChatPage({super.key});
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: const Text(App.title)),
body: LlmChatView(
provider: GeminiProvider(
chatModel: GenerativeModel(
model: 'gemini-1.5-flash',
apiKey: geminiApiKey,
),
),
),
);
}