-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathgemini.dart
35 lines (27 loc) · 975 Bytes
/
gemini.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// 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() => 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(
model: GenerativeModel(model: 'gemini-1.5-flash', apiKey: geminiApiKey),
),
),
);
}