flutter_ai_toolkit 0.1.0 flutter_ai_toolkit: ^0.1.0 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';
const String googleApiKey = 'TODO: Set your Google API key';
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(
model: 'gemini-1.5-flash',
apiKey: googleApiKey,
),
),
);
}