flutter_foundation_models 0.2.2 copy "flutter_foundation_models: ^0.2.2" to clipboard
flutter_foundation_models: ^0.2.2 copied to clipboard

PlatformiOS

Flutter plugin for Apple's on-device Foundation Models. Generate text, structured output, and use tools with the on-device language model.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_foundation_models_example/my_weather.dart';
import 'package:flutter_foundation_models_example/novel_generator.dart';
import 'package:flutter_foundation_models_example/transcript_demo.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  int _selectedIndex = 0;

  static const List<Widget> _pages = [
    MyWeather(),
    NovelGenerator(),
    TranscriptDemo(),
  ];

  void _onItemTapped(int index) {
    setState(() {
      _selectedIndex = index;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Foundation Models Demo'),
        ),
        body: _pages[_selectedIndex],
        bottomNavigationBar: BottomNavigationBar(
          items: const [
            BottomNavigationBarItem(
              icon: Icon(Icons.cloud),
              label: 'Weather',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.book),
              label: 'Novel',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.history),
              label: 'Transcript',
            ),
          ],
          currentIndex: _selectedIndex,
          onTap: _onItemTapped,
        ),
      ),
    );
  }
}
1
likes
160
points
287
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for Apple's on-device Foundation Models. Generate text, structured output, and use tools with the on-device language model.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_foundation_models_annotations, plugin_platform_interface

More

Packages that depend on flutter_foundation_models

Packages that implement flutter_foundation_models