registerIntentHandler method

  1. @override
void registerIntentHandler(
  1. String identifier,
  2. IntentHandler handler
)
override

Registers a handler for the specified intent.

When an intent with the given identifier is executed from iOS (via Siri or Shortcuts), the handler will be called with the intent's parameters.

The handler should return a map containing the result of the intent execution, which will be passed back to iOS.

Example:

AppIntentsPlatform.instance.registerIntentHandler(
  'com.example.AddTaskIntent',
  (params) async {
    final title = params['title'] as String;
    // Add the task...
    return {'taskId': 'new-task-id'};
  },
);

Implementation

@override
void registerIntentHandler(
  String identifier,
  IntentHandler handler,
) {
  _intentHandlers[identifier] = handler;
}