RemoteAction<Input, Output, Chunk, Init> constructor

RemoteAction<Input, Output, Chunk, Init>({
  1. required String url,
  2. Map<String, String>? defaultHeaders,
  3. Client? httpClient,
  4. required Output fromResponse(
    1. dynamic jsonData
    ),
  5. required Chunk fromStreamChunk(
    1. dynamic jsonData
    )?,
})

Represents a remote Genkit action (flow) that can be invoked or streamed.

This class is typically instantiated via defineRemoteAction. It encapsulates the URL, default headers, HTTP client, and data conversion logic for a specific flow.

Type parameters:

  • Output: The type of the output data from a non-streaming flow invocation, or the type of the final response from a streaming flow.
  • Chunk: The type of the data chunks streamed from the flow.

Implementation

RemoteAction({
  required this._url,
  this._defaultHeaders,
  http.Client? httpClient,
  required this._fromResponse,
  required this._fromStreamChunk,
}) : _httpClient = httpClient ?? http.Client(),
     _ownsHttpClient = httpClient == null;