cupertino_fundations_models 0.0.1 copy "cupertino_fundations_models: ^0.0.1" to clipboard
cupertino_fundations_models: ^0.0.1 copied to clipboard

A Flutter plugin for Apple Foundation Models, structured generation, tool calling, and on-device AI on supported Apple platforms.

Cupertino Foundations Models #

A Flutter bridge to easily access Apple's local on-device models on iOS 27. Similar to how Firebase AI works, but optimized to leverage Apple Foundation Models with maximum performance and privacy.

Features #

  • ✨ Simplified Local Model Access β€” Clean Dart interface to interact with Apple Foundation Models
  • πŸ”§ Function Calling β€” Execute functions through models with type-safe operations
  • πŸ“Š Structured Generation β€” Define schemas for structured and validated responses
  • πŸš€ On-Device AI β€” Everything runs locally, no external dependencies
  • πŸ”’ Privacy β€” Your data never leaves the device
  • ⚑ Performance β€” Minimal latency with on-device processing

Requirements #

  • iOS 27+ (requires access to Apple Foundation Models)
  • Flutter 1.17.0+
  • Dart 3.11.0+

Installation #

Add cupertino_fundations_models to your pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  cupertino_fundations_models: ^0.0.1

Then run:

flutter pub get

Usage #

Basic Initialization #

import 'package:cupertino_fundations_models/cupertino_fundations_models.dart';

// Initialize the client
final modelClient = CupertinoFoundationModels();
await modelClient.initialize();

Simple Text Generation #

// Generate text with the local model
final response = await modelClient.generateText(
  prompt: "Tell me a joke about programming",
);
print(response);

Function Calling #

// Define functions that the model can invoke
final result = await modelClient.callWithFunctions(
  prompt: "What is the capital of France?",
  functions: [
    ModelFunction(
      name: "get_country_capital",
      description: "Gets the capital of a country",
      parameters: {
        "country": {"type": "string", "description": "Name of the country"}
      },
    ),
  ],
);

Structured Generation #

// Get responses in validated JSON format
final result = await modelClient.generateStructured(
  prompt: "Generate a salad recipe",
  schema: {
    "type": "object",
    "properties": {
      "name": {"type": "string"},
      "ingredients": {
        "type": "array",
        "items": {"type": "string"}
      },
      "steps": {
        "type": "array",
        "items": {"type": "string"}
      }
    },
    "required": ["name", "ingredients", "steps"]
  },
);

Why Use This Package? #

While Apple's models are available on iOS 27, the learning curve to use them from Flutter can be steep. This package:

  • Simplifies Integration β€” No need to write complex native code
  • Provides Clear Abstractions β€” Intuitive classes and methods
  • Handles Technical Details β€” Manages configuration, errors, and lifecycle
  • Offers Proven Patterns β€” Recommended usage of function calling and structured generation

Limitations #

  • Available models are predetermined by Apple (not possible to select specific models)
  • Requires iOS 27+, not available on other platforms in this version

Additional Examples #

Check the /example folder for more examples and advanced use cases.

Contributing #

Contributions are welcome. Please:

  1. Open an issue to discuss major changes
  2. Fork the repository, make your changes, and open a pull request
  3. Ensure all tests pass

License #

This project is licensed under the MIT License. See the LICENSE file for details.

Author #

Created by SebastiΓ‘n Villa (SoyVilla)

0
likes
0
points
130
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for Apple Foundation Models, structured generation, tool calling, and on-device AI on supported Apple platforms.

License

unknown (license)

Dependencies

flutter

More

Packages that depend on cupertino_fundations_models