app_intents

pub package License: MIT

Flutter plugin for iOS App Intents and Android AppFunctions integration. Enables Siri, Shortcuts, Spotlight, and AI agent (Gemini) support for your Flutter app.

Features

  • Register intent handlers to respond to Siri, Shortcuts, and AI agent actions
  • Define entity queries for parameter pickers in Shortcuts
  • Stream-based intent execution events
  • Cross-platform: iOS App Intents + Android AppFunctions
  • Seamless integration with app_intents_annotations and app_intents_codegen

Requirements

  • iOS: 17.0+
  • Android: your app's existing minSdk (Flutter default 24); AppFunctions are served on API 36+ (Android 16) only
  • Flutter: 3.3+

Installation

Add app_intents to your pubspec.yaml:

dependencies:
  app_intents: ^0.20.0
  app_intents_annotations: ^0.20.0

dev_dependencies:
  app_intents_codegen: ^0.20.0
  build_runner: ^2.4.0

Usage

Basic Setup

import 'package:app_intents/app_intents.dart';

final appIntents = AppIntents();

// Register an intent handler
appIntents.registerIntentHandler(
  'com.example.AddTaskIntent',
  (params) async {
    final title = params['title'] as String;
    // Process the intent...
    return {'taskId': 'new-task-id'};
  },
);

Entity Queries

Provide entities for parameter pickers in Shortcuts:

// Query entities by identifiers
appIntents.registerEntityQueryHandler(
  'TaskEntity',
  (identifiers) async {
    final tasks = await database.getTasksByIds(identifiers);
    return tasks.map((t) => {
      'id': t.id,
      'title': t.title,
    }).toList();
  },
);

// Provide suggested entities
appIntents.registerSuggestedEntitiesHandler(
  'TaskEntity',
  () async {
    final recentTasks = await database.getRecentTasks(limit: 10);
    return recentTasks.map((t) => {
      'id': t.id,
      'title': t.title,
    }).toList();
  },
);

Intent Execution Stream

Listen to intent executions reactively:

appIntents.onIntentExecution.listen((request) {
  print('Intent ${request.identifier} executed');
  print('Parameters: ${request.params}');
});

Storage Configuration (iOS)

For cache-mode intents, configure App Group storage to enable cross-process data sharing. Without this, data may appear to "reset" when App Intents run in extension processes.

// Call before any cache operations (typically in main())
await appIntents.configureStorage(
  appGroupIdentifier: 'group.com.example.app',
);

On the iOS side, also call in your AppDelegate:

AppIntentsPlugin.configure(appGroupIdentifier: "group.com.example.app")

Caching API

For foreground intent execution (cache mode), the plugin provides caching support:

// Process pending actions when app resumes
final hasPending = await appIntents.processPendingActions();

// Listen for pending actions
appIntents.pendingActionsStream.listen((identifier) {
  print('Pending action: $identifier');
});

// Cache values for intent parameters
await appIntents.setCachedValue('key', 'value');
final value = await appIntents.getCachedValue('key');
await appIntents.clearCachedValue('key');

iOS Configuration

  1. Set iOS deployment target to 17.0+ in ios/Podfile:
platform :ios, '17.0'
  1. See the full documentation for complete iOS setup instructions including Swift code generation.

Android Configuration

  1. Set compileSdk/targetSdk to 37 in android/app/build.gradle.kts (keep your minSdk: the generated service is @RequiresApi(36), and the required android:enabled="@bool/app_intents_app_functions_service_enabled" on its manifest entry disables it on older devices)
  2. Add KSP and AppFunctions dependencies
  3. See the full documentation for complete Android setup instructions including Kotlin code generation.

License

MIT License - see the LICENSE file for details.

Libraries

app_intents
Flutter plugin for iOS App Intents integration.
app_intents_method_channel
app_intents_platform_interface