flutter_ai_stream 0.0.2 copy "flutter_ai_stream: ^0.0.2" to clipboard
flutter_ai_stream: ^0.0.2 copied to clipboard

Real-time streaming AI SDK for Flutter with Gemini, OpenAI, Claude & Tool Calling support.

flutter_ai_stream #

flutter_ai_stream Preview

Real-time streaming AI SDK for Flutter with Google Gemini, OpenAI, Anthropic Claude & Tool Calling support.

pub package License: MIT

Features #

  • Multi-Provider AI: Google Gemini 2.0/1.5, OpenAI GPT-4o, Anthropic Claude, and Ollama.
  • Real-Time Token Streaming (SSE): Blazing fast reactive responses without polling.
  • Declarative Tool Calling: Register native Dart functions as AI tools with automatic execution.
  • Ready-to-Use UI: Drop-in AiChatView with auto-scroll, smooth animations, and theming.
  • Smart Conversation Memory: Automated history management, retry, and cancellation.

Getting Started #

Add flutter_ai_stream to your pubspec.yaml:

dependencies:
  flutter_ai_stream: ^0.0.1

Quick Start (Gemini) #

import 'package:flutter/material.dart';
import 'package:flutter_ai_stream/flutter_ai_stream.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: AiChatScreen(),
    );
  }
}

class AiChatScreen extends StatefulWidget {
  const AiChatScreen({super.key});

  @override
  State<AiChatScreen> createState() => _AiChatScreenState();
}

class _AiChatScreenState extends State<AiChatScreen> {
  late final AiChatController _controller;

  @override
  void initState() {
    super.initState();
    _controller = AiChatController(
      config: const AiConfig(
        provider: AiProvider.gemini,
        apiKey: 'YOUR_GEMINI_API_KEY',
        model: 'gemini-2.0-flash',
        systemInstruction: 'You are a helpful coding assistant.',
      ),
    );
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Flutter AI Stream')),
      body: AiChatView(controller: _controller),
    );
  }
}

Author #

Developed with passion by Ibrohim Qobilov (GitHubLinkedIn).

0
likes
140
points
108
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Real-time streaming AI SDK for Flutter with Gemini, OpenAI, Claude & Tool Calling support.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, http

More

Packages that depend on flutter_ai_stream