Skip to content

stefanoamorelli/ai-edge-sdk

Repository files navigation

AI Edge SDK for Flutter

Flutter plugin for Google's AI Edge SDK - brings Gemini Nano on-device AI to your Flutter apps.

Tests Coverage Platform

Gemini Nano brings Google's most efficient AI model directly to your device, enabling private, fast AI inference without internet connectivity. On-device AI represents the future of mobile computing, providing instant responses while keeping your data completely private.

Important

This is an experimental open-source project. The underlying Google AI Edge SDK is in beta and APIs may change. Use at your own risk.

Requirements

Why So Restrictive?

Gemini Nano requires specialized NPU hardware only available in Pixel 9 devices. This case is part of Google's experimental AI program - broader device support may come later.

Installation

dependencies:
  ai_edge_sdk: ^1.0.0

Quick Start

import 'package:ai_edge_sdk/ai_edge_sdk.dart';

final sdk = AiEdgeSdk();

// Check if your device is supported
if (await sdk.isSupported()) {
  await sdk.initialize();
  
  final result = await sdk.generateContent('Rewrite this professionally: hey whats up');
  print(result.content);
} else {
  print('Sorry, requires Pixel 9 series device');
}

Features

  • Device validation - Automatic Pixel 9 series detection
  • Content generation - Text completion and creative writing
  • Streaming responses - Real-time token generation
  • Error handling - Comprehensive exception management
  • Privacy-first - All processing happens on-device

Testing

Cannot test with emulator. You need a physical Pixel 9.

Run unit tests:

flutter test --coverage

Example App

The /example folder contains a complete demo app that shows device compatibility checking and error handling.

cd example
flutter run
# Shows device info and compatibility status

Contributing

See SECURITY.md for security practices and reporting vulnerabilities.

References

License

MIT - Copyright Stefano Amorelli 2025 - see LICENSE.md