react_actions library

Browser-safe protocol for server function invocation.

Classes

CompactServerFunctionRequest
A validated server-function request carried by a compact invoke frame.
ReactFrame
A compact, versioned binary message used by React Dart transports.
ReactFrameFlags
Optional flags stored in a ReactFrame.
ServerDataAnnotation
ServerFunctionAnnotation
ServerFunctionClient
Transport abstraction for invoking server functions from the browser.
ServerFunctionError
A structured error payload inside a ServerFunctionResponse.
ServerFunctionId
Opaque identifier for a registered server function.
ServerFunctionJsonCodec<T>
Serializes and deserializes function arguments or results between Dart values and JSON-compatible maps/lists/primitives.
ServerFunctionRef<TArgs, TResult>
A typed reference to a registered server function.
ServerFunctionRequest
A JSON-serializable request envelope sent from the browser to the server function endpoint.
ServerFunctionResponse
A JSON-serializable response envelope sent from the server back to the browser.

Enums

ReactMessageKind
Message types supported by the compact protocol.

Constants

compactProtocolContentType → const String
Content type for a compact React Dart frame.
compactProtocolMagic → const List<int>
The three-byte marker at the beginning of every compact frame.
compactProtocolMaxPayloadBytes → const int
Maximum CBOR payload accepted by ReactFrame.
compactProtocolVersion → const int
Version of the compact React Dart frame protocol.
serverData → const ServerDataAnnotation
Marks a class as a browser-safe data transfer type for server function contracts.
serverFunction → const ServerFunctionAnnotation
Marks a function as a server function.
serverFunctionContentType → const String
Media type for the JSON server-function envelope.
serverFunctionContractHeader → const String
Header carrying the generated codec contract hash.
serverFunctionIdHeader → const String
Header carrying the generated server-function ID.
serverFunctionProtocolHeader → const String
Header carrying the protocol version.
serverFunctionProtocolVersion → const int
Current wire protocol version for React Dart server functions.

Properties

currentServerFunctionClient ServerFunctionClient
The currently active ServerFunctionClient.
no setter

Functions

compactActionId(String id) int
Returns the build-independent numeric hint for a generated action ID.
failureToResponse(ServerFunctionFailure failure, {String? requestId}) ServerFunctionResponse
Converts a ServerFunctionFailure into a ServerFunctionResponse.
runWithServerFunctionClient<T>(ServerFunctionClient client, T callback()) → T
Runs callback with client as the current server function client.

Exceptions / Errors

RemoteServerFunctionException
A decoded server error received by the client.
ServerFunctionFailure
A deliberate failure thrown by server business logic.
ServerFunctionTransportException
A transport-level failure (network error, timeout, invalid response).