Server class final
Adapter-neutral runtime for typed routes and server functions.
Constructors
-
Server({required Iterable<
RouteNode> routes, Map<String, ServerFunctionBinding> functions = const <String, ServerFunctionBinding>{}, Iterable<Middleware> middleware = const <Middleware>[], Iterable<Module> modules()?, InvocationModuleFactory? invocationModules, Iterable<RouteNode> flutterRoutes = const <RouteNode>[], Serializer? serializer, Renderer? renderer, ServerErrorHandler? onError, ServerCloseHandler? onClose, String functionPath = '/__odroe/functions', int maxFunctionPayload = defaultMaxFunctionPayload, int maxFunctionResponseFrameBytes = defaultMaxFunctionResponseFrameBytes, bool exposeErrors = false, bool allowRpcWithoutOrigin = false, Uri? publicOrigin}) - Creates a server from explicitly selected routes and capabilities.
Properties
- allowRpcWithoutOrigin → bool
-
Whether RPC requests without origin metadata are accepted.
final
- exposeErrors → bool
-
Whether failure responses may expose internal details.
final
- functionPath → String
-
Prefix used by generated server functions.
final
-
functions
→ Map<
String, ServerFunctionBinding> -
Server function bindings keyed by generated identifier.
final
- handler → ServerHandler
-
A handler suitable for platform adapters.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- invocationHandler → ServerInvocationHandler
-
An invocation-aware handler suitable for edge adapters.
no setter
- invocationModules → InvocationModuleFactory?
-
Creates additional modules from adapter-owned invocation state.
final
- maxFunctionPayload → int
-
Maximum buffered server function payload size.
final
- maxFunctionResponseFrameBytes → int
-
Maximum UTF-8 bytes in one typed server-function response frame.
final
-
middleware
→ List<
Middleware> -
Middleware applied to every request.
final
-
modules
→ Iterable<
Module> Function() -
Creates explicitly selected request-scoped modules.
final
- onError → ServerErrorHandler
-
Reports unexpected module setup, request execution, and response stream
failures.
final
- publicOrigin → Uri?
-
Fixed external origin accepted by RPC when deployed behind a proxy.
final
- renderer → Renderer?
-
Optional renderer used by GET and HEAD routes without a direct handler.
final
-
routes
→ List<
RouteNode> -
Routes matched by this server.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serializer → Serializer
-
Serializer shared by server functions and renderers.
final
Methods
-
close(
) → Future< void> - Stops accepting invocations, drains started work, and releases resources.
-
handle(
ServerRequest request) → Future< ServerResponse> - Handles one request with a binding-free invocation.
-
handleInvocation(
ServerRequest request, ServerInvocation invocation) → Future< ServerResponse> - Handles one invocation and disposes its modules after all work completes.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
validatePublicOrigin(
Uri value) → Uri - Validates and canonicalizes a fixed HTTP(S) deployment origin.
Constants
- defaultMaxFunctionPayload → const int
- Default maximum buffered server-function request size: 1 MiB.
- defaultMaxFunctionResponseFrameBytes → const int
- Default maximum typed server-function response frame size: 1 MiB.
- minimumFunctionResponseFrameBytes → const int
- Smallest valid typed response budget.