enqueue method

Future<void> enqueue(
  1. Map<String, dynamic> data, [
  2. TaskOptions? options
])

Enqueues a task with the given data payload.

The data will be JSON-encoded and sent to the function.

Optional options can specify:

  • Schedule time (absolute or delay)
  • Dispatch deadline
  • Task ID (for deduplication)
  • Custom headers
  • Custom URI

Example:

await queue.enqueue(
  {'userId': '123', 'action': 'sendEmail'},
  TaskOptions(
    scheduleDelaySeconds: 3600, // Send in 1 hour
    id: 'unique-task-id',
  ),
);

Throws FirebaseFunctionsAdminException if the request fails.

Implementation

Future<void> enqueue(Map<String, dynamic> data, [TaskOptions? options]) {
  return _requestHandler.enqueue(data, _functionName, _extensionId, options);
}