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: API 36+ (Android 16, for AppFunctions)
  • Flutter: 3.3+

Installation

Add app_intents to your pubspec.yaml:

dependencies:
  app_intents: ^0.6.1
  app_intents_annotations: ^0.6.1

dev_dependencies:
  app_intents_codegen: ^0.6.1
  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}');
});

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 and minSdk to 36 in android/app/build.gradle.kts
  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