registerEntityQueryHandler method
void
registerEntityQueryHandler()
Registers a handler for querying entities by their identifiers.
When iOS needs to resolve entity references (e.g., when a user selects a specific item in Shortcuts), this handler will be called with the list of entity identifiers to look up.
The handler should return a list of entity maps, each containing
at minimum an 'id' field and any display properties needed by iOS.
Example:
AppIntentsPlatform.instance.registerEntityQueryHandler(
'TaskEntity',
(identifiers) async {
final tasks = await database.getTasksByIds(identifiers);
return tasks.map((t) => {
'id': t.id,
'title': t.title,
'displayRepresentation': t.title,
}).toList();
},
);
Implementation
void registerEntityQueryHandler(
String entityIdentifier,
Future<List<Map<String, dynamic>>> Function(List<String> identifiers)
handler,
) {
throw UnimplementedError(
'registerEntityQueryHandler() has not been implemented.');
}