Flutter App Intents Examples
This folder contains three complete example applications demonstrating different use cases for the flutter_app_intents package with Apple App Intents, enabling features like Siri voice commands, Shortcuts, and Spotlight search.
Examples Overview
Action-based App Intents - Demonstrates intents that perform operations without navigation.
Features:
- Increment counter (with optional amount parameter)
- Reset counter to zero
- Get current counter value
- Intent donation for Siri learning
- Parameter handling and validation
Best for learning:
- Basic App Intents implementation
- Parameter handling
- Action-based voice commands
- iOS static intent declarations
Navigation-based App Intents - Demonstrates deep linking and app navigation through intents.
Features:
- Open user profile page
- Launch chat with specific contact
- Navigate to search with query
- Open app settings
- Deep linking with route parameters
Best for learning:
- Navigation intents with
OpensIntent
- Deep linking with parameters
- Multi-page Flutter navigation
- Route configuration and argument passing
Query-based App Intents - Demonstrates background data queries with voice responses.
Features:
- Get current weather information
- Check specific temperature data
- Retrieve multi-day forecasts
- Boolean rain checks
- Background operation without opening app
Best for learning:
- Query intents with
ProvidesDialog
- Background data processing
- Voice response formatting
- Multiple parameter types
- Information retrieval patterns
Choosing the Right Example
| Use Case |
Example |
Intent Type |
Return Type |
| Perform app actions |
Counter |
Action Intent |
ReturnsValue<String> |
| Navigate to app pages |
Navigation |
Navigation Intent |
OpensIntent |
| Query data with voice |
Weather |
Query Intent |
ProvidesDialog |
| Background operations |
Weather |
Query Intent |
ProvidesDialog |
| Deep linking |
Navigation |
Navigation Intent |
OpensIntent |
Architecture
All examples demonstrate the hybrid approach required for Flutter App Intents:
- Static Swift App Intents (
ios/Runner/AppDelegate.swift) - Required for iOS discovery
- Flutter handlers (
lib/main.dart) - Your app’s business logic
- Bridge communication - Static intents call Flutter handlers via the plugin
Quick Start
Prerequisites
- Flutter environment with iOS development setup
- iOS 16.0 or later device or simulator
- Xcode 14.0 or later
Running the Examples
Counter Example (Action Intents):
cd counter
flutter pub get
flutter run
Navigation Example (Deep Linking):
cd navigation
flutter pub get
flutter run
Weather Example (Query Intents):
cd weather
flutter pub get
flutter run
Testing App Intents
- Shortcuts App: Check for your app’s shortcuts under “App Shortcuts”
- ⚠️ CRITICAL: Enable Siri - In Shortcuts app → [Your App] → Info icon → Toggle ON Siri (OFF by default!)
- Siri Commands: Use voice commands with your app name
- Settings: Go to Settings > Siri & Search > App Shortcuts
- Manual Testing: Use in-app buttons to test functionality
Common Troubleshooting
Shortcuts not appearing?
- Ensure iOS 16.0+ device/simulator
- Wait for iOS to register static intents
- Check console logs for registration status
- Try restarting the Shortcuts app
Siri not recognizing commands?
- FIRST: Check Siri toggle is ON (Shortcuts app → [Your App] → Info icon → Siri toggle green)
- Use exact app name in voice commands
- Try manual shortcuts first to help Siri learn
- Add custom phrases in Settings > Siri & Search
For detailed troubleshooting, see the main README.
Implementation Guide
For Action Intents (like Counter):
return AppIntentResult.successful(
value: 'Action completed successfully',
needsToContinueInApp: false, // Optional for actions
);
For Navigation Intents (like Navigation):
return AppIntentResult.successful(
value: 'Opening page...',
needsToContinueInApp: true, // Required for navigation
);
Next Steps
- Start with Counter - Learn basic App Intents concepts
- Try Navigation - Understand deep linking and navigation patterns
- Combine Both - Create apps with mixed intent types
- Customize - Add your own intents and parameters
Both examples include comprehensive documentation and are production-ready starting points for your own App Intents implementation.