RemoteAction<O, S> constructor
RemoteAction<O, S> ({})
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:
O
: The type of the output data from a non-streaming flow invocation, or the type of the final response from a streaming flow.S
: The type of the data chunks streamed from the flow.
Implementation
RemoteAction({
required String url,
Map<String, String>? defaultHeaders,
http.Client? httpClient,
required O Function(dynamic jsonData) fromResponse,
S Function(dynamic jsonData)? fromStreamChunk,
}) : _url = url,
_defaultHeaders = defaultHeaders,
_httpClient = httpClient ?? http.Client(),
_ownsHttpClient = httpClient == null,
_fromResponse = fromResponse,
_fromStreamChunk = fromStreamChunk;