chat_gpt_flutter 1.0.16 copy "chat_gpt_flutter: ^1.0.16" to clipboard
chat_gpt_flutter: ^1.0.16 copied to clipboard

Integration of OpenAI API using Flutter framework, ChatGPT and more

example/lib/main.dart

import 'package:chat_gpt_flutter/chat_gpt_flutter.dart';
import 'package:example/chat_completion_page.dart';
import 'package:example/completion_page.dart';
import 'package:example/secrets.dart';
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

//TODO: put your own apiKey
final chatGpt = ChatGpt(apiKey: apiKey);

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        inputDecorationTheme: InputDecorationTheme(
          isDense: true,
          fillColor: Colors.transparent,
          border: OutlineInputBorder(
            borderRadius: BorderRadius.circular(12),
            borderSide: const BorderSide(color: Colors.black, width: 2),
          ),
        ),
      ),
      home: DefaultTabController(
        length: 2,
        child: Scaffold(
          appBar: AppBar(
            bottom: const TabBar(
              tabs: [
                Tab(icon: Text('Chat completion')),
                Tab(icon: Text('Completion')),
              ],
            ),
          ),
          body: TabBarView(
            children: [
              ChatCompletionPage(chatGpt: chatGpt),
              CompletionPage(chatGpt: chatGpt),
            ],
          ),
        ),
      ),
    );
  }
}
43
likes
150
pub points
93%
popularity

Publisher

unverified uploader

Integration of OpenAI API using Flutter framework, ChatGPT and more

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dio, flutter, http, json_annotation, json_serializable, pretty_dio_logger

More

Packages that depend on chat_gpt_flutter