flutter_gemma 0.16.3 copy "flutter_gemma: ^0.16.3" to clipboard
flutter_gemma: ^0.16.3 copied to clipboard

A Flutter plugin for running Gemma and other LLMs locally on Android, iOS, Web, and Desktop. Supports multimodal vision, audio, function calling, thinking mode, GPU acceleration, text embeddings, and [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_gemma/flutter_gemma.dart';
import 'package:flutter_gemma_example/home_screen.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Initialize Flutter Gemma.
  //
  // `WebStorageMode.streaming` (OPFS-backed) is required for `.litertlm`
  // web models in 0.16.2+ — the @litert-lm/core engine consumes a
  // ReadableStream from OPFS, avoiding Chrome's ~2 GB blob-fetch limit
  // that bites the cacheApi path on Gemma 4 E2B/E4B web variants.
  // MediaPipe `.task` models also work fine under streaming mode.
  await FlutterGemma.initialize(
    webStorageMode: WebStorageMode.streaming,
  );

  runApp(const ChatApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Gemma Example',
      darkTheme: ThemeData(
        brightness: Brightness.dark,
        textTheme: const TextTheme(
          bodyLarge: TextStyle(color: Colors.white),
          bodyMedium: TextStyle(color: Colors.white),
        ),
      ),
      themeMode: ThemeMode.dark,
      home: const SafeArea(child: HomeScreen()),
    );
  }
}
375
likes
130
points
15.9k
downloads

Documentation

API reference

Publisher

verified publishermobilepeople.dev

Weekly Downloads

A Flutter plugin for running Gemma and other LLMs locally on Android, iOS, Web, and Desktop. Supports multimodal vision, audio, function calling, thinking mode, GPU acceleration, text embeddings, and on-device RAG.

Repository (GitHub)
View/report issues
Contributing

License

MIT (license)

Dependencies

background_downloader, code_assets, crypto, dart_sentencepiece_tokenizer, ffi, flutter, flutter_web_plugins, hooks, large_file_handler, local_hnsw, mutex, path, path_provider, plugin_platform_interface, shared_preferences, sqlite3, uuid

More

Packages that depend on flutter_gemma

Packages that implement flutter_gemma